Thursday, April 3, 2014

Reversing launchctl of Plex (PMS)

In my previous post, I covered adding the behavior to support launching the Plex Media Server (PMS) after logging.  That was fine, except the extra cycles stolen from the general use of the machine was making the machine more painful to use.  With that, I am going to cover reversing the actions from my previous post to auto launch PMS after log in.  This will provide the needed resources that are required for the users at the machine.

First up, looking in the folder, /Library/LaunchAgents.  This proved to be a dead end.  The plist file originally entered there was now gone or I changed my mind (and don't remember).  I then looked in /Library/LaunchDaemons.  It sort of sounds the same, so why not right?  Again, nothing.  Hmm.

Well, worse case scenario, I know the file name.  I can just use the find command.
find / com.plex.pms.plist | grep plex.pms
Fairly brute force, but it worked!  In a matter of a couple of minutes I found my file.  It was in the directory, /System/Library/LaunchAgents.  It has been a while, so I don't recall placing the file there.  A quick change directory command into the folder and we can start surgically removing the auto launch of PMS.  First, let's unload the launch agent.
launchctl unload com.plex.pms.plist
Next, you can move or remove that file from the directory.  This will ensure that PMS doesn't automatically load when a user logs into the machine.

Now log out and log back into to your account.  You should see that you're no longer launching PMS at log in.