Running Plex Server as a daemon on macMini

Hi.

Because I trust the experts here. I already asked on the plex forum (Running Plex as system service on macOS - Desktops & Laptops - Plex Forum) and on Mastodon (Rainer M Krug: "#plexmediaserver #macos #mac #plex I am running…" - Hachyderm.io) but no response so far - so I have to go the the Mac experts…

I am running PMS on a M2 macMini 8GB (usually headless). PMS starts when the specific user (lets call it “server”) logs in, so this is working.
Now I a have to use, at the moment, the macMini for work with a monitor attached, and for certain applications (keyboard and mouse sharing) it is necessary that no other user is logged in apart from my account.

Is it possible to run PMS as a system service on macOS, which starts when the system starts, i.e. that no user needs to be logged in? It should not be to difficult to install it as a daemon using launchcontrol, but I have at the moment not the k now ledge how. Furthermore: are there any pitfalls? Or doesn’t it work?

Any tips welcome,

Rainer

I have no idea, but I was able to find this:

My Plex server has been known to quit abruptly, which I wouldn’t necessarily know about until much later if I wanted to watch something or one of my friends was trying to watch something and messaged me that it was down. (…) So I decided to create a LaunchDaemon that will launch Plex at boot and then keep it running at all times, whether I am logged into my account, logged out, whatever, except if I specifically quit it manually, in which case it stays down until reopened. It does this by polling the Plex status any time a volume is mounted or unmounted or if path to the external drive becomes empty.

All one needs to do is drop the file com.plexapp.plexmediaserver.plist into /Library/LaunchDaemons/ folder. I believe since the Disabled flag is set to “No” it should just begin running immediately.

Source: https://www.reddit.com/r/PleX/comments/qjfhzp/keep_plex_for_macos_running_continuously_with/

The plist file mentioned over there is not available any longer, but apparently this one should work, too: Plex Media center startup plist for use with launchctl · GitHub

Note: if it does not work, have a look at this comment at GitHub:

Have had to move this plist into /Library/LaunchAgents as it wouldn’t work after restart if left in the LaunchDaemons folder…fyi.

It may work or not - but it could be a starting point for further investigation. If it does not launch in a pre-login state in LaunchAgents, have a look at macos - Execute a script with GUI Access before login - Ask Different

I am not using Plex, so maybe others have a better solution that they are using themselves. :slight_smile:

1 Like