I really need the ability to launch Plex Media Server on boot up

I love Plex…but after adding a second account to my Mac, I’ve found the only way to keep Plex running is to be signed into my primary account. Bummer.
This would be a huge add, in my opinion.

Aside from the fact that the Plex developers really should have incorporated this facility years ago, what we have here is totally inconclusive. One person says yes it can be done and is working for him, yet others say it doesn’t work and post error messages that indicate it is simply not going to be possible. In which case, how did Darwinner get it to work?

Either he did something different, or is using a different build of PMS or, well, he’s lying.

Hoping the last is not true and thinking the second is unlikely, that leaves the first alternative. Something he did is different, but what, as Darwinner himself has been notably absent since stating it works for him.

One (admittedly improbable) possibility that occurred to me is he used a ‘system’ user (i.e. UID < 500) whereas others used a normal user with UID > 500 (let’s ignore UID = 500 for the purposes of this discussion). In which case, is it possible that PMS requires access to the WindowServer etc when run with UID > 500, but not when UID < 500?

I realise this seems rather unlikely, but it might explain the symptoms. Anyone tried it with a UID < 500?

Otherwise, what could possibly be the reason why it works for one, but not others?

Look at this post: http://forums.plex.tv/discussion/250063/running-plex-for-all-user-accounts#latest I’ve been running this for a few weeks now without any problems (Well, today my mac crashed and now plex won’t start, but I don’t think it’s related).

It’s pretty much secure. When I’m not home the mac starts up as the user “plex” and starts up the server. When I’m home, I start up the computer under my user and start the media server manually. They both point to the same directory in the “shared” user directory so always stay in sync.

@donbryn said:
Look at this post: http://forums.plex.tv/discussion/250063/running-plex-for-all-user-accounts#latest I’ve been running this for a few weeks now without any problems (Well, today my mac crashed and now plex won’t start, but I don’t think it’s related).

It’s pretty much secure. When I’m not home the mac starts up as the user “plex” and starts up the server. When I’m home, I start up the computer under my user and start the media server manually. They both point to the same directory in the “shared” user directory so always stay in sync.

I appreciate what you are saying but in truth it’s a dumb-ass way of having to operate a server. That’s no criticism of you as it’s what I’ve had to do for years to effectively run an iTunes ‘server’, but which I wanted to get away from by switching to Plex which as an intended server (unlike iTunes) I expected to be able to run as a real server, i.e. in the background with no user login required. That’s how a true server should operate, otherwise one could just as easily run it on one’s own personal machine.

I’m not overly concerned with security issues. If anyone unwanted has physical access to my media server, I’ve got bigger things to worry about than Plex. What I want is products that do what they are supposed to do and do it RIGHT. A server product should NOT require any user login. That’s just the way it is. It’s the definition of server really and products like Plex should do it right and not require any such faffing about to try and circumvent the lack of understanding of the developers.

What’s worse is that they (apparently) get it right with linux on which PMS can be run in the background. So why not the Mac? It’s just dumb, particularly when it doesn’t actually need access to the screen anyway. It’s not like PMS has any display that is used to control and configure it. That’s all done via a browser anyway which is great and as it should be, but they then don’t follow it through and its code demands access to the screen (for no reason) so it won’t run as required. As I said, dumb.

Well, to modify that slightly, they are apparently looking to change this in the future so it can run in the background in MacOS, but they stated this intention over 4 years ago and you don’t want me to say what I think of developers who cannot fix something like this after all that time.

This was a totally unexpected draw back from moving PMS from my NAS to my Mac for more transcoding power. The Mac actually acts as a server too, so its always on, but having to log in after a reboot isn’t very “Server like”. interim solution until PLEX fixes this so we can run PMS in a true service fashion om Macs, is to lock the screen instead using Key Chain. For you who don’t know about this Key Chain har a menu bar icon if you go into settings and check the box for it. you can then click on the pad lock icon and choose lock screen.

A variant of this for autostart is to activate screen saver on a short timer and set the appropriate account to auto login. then the computer reboots, logs in automatically and then after set time, locks itself demanding a password to get back in. if you have more users logging on, they can leaving your account locked and logged in. Not perfect, but a decent workaround…

1 Like

First a quick comment: I’m not a Plex Pass user – but I can think of no other single feature I want more, than daemonizing under OSX. If they’re ever considering Pass-only features that will entice people into upgrading, this is a huge one.

Onwards. I did notice Plex devs had once supported a Docker script. At the expense of a little overhead, this would solve the issue for most semi-technical Mac users. Docker (these days) runs as a first-class Mac application, itself a daemon, which can run other containers as daemons. It’s uncertain if Plex still “supports” Docker (I saw elsewhere, something about the plex tag being out of date…)

For those who want to try OSX Docker and then a Docker tutorial:

NOTE: The above link isn’t OSX-specific. It should still be fine. Since the Summer release, Docker for OSX is very close to the Linux user experience (same with Docker for Windows, though I don’t use that OS ever).

NOTE if you try to share/mount a path outside of the current Mac user, you MAY get a Docker error about OSX filesystem issues. The error is helpful with instructions (I know, I followed the step at work and it resolved a non-Plex issue I had with /custom/path/to/mountpoint/). More info: https://docs.docker.com/docker-for-mac/osxfs/

@ScottInNH said:

To be clear, I have NOT tested Docker yet. Others have I have OS X running under a user. I too have to be inconvenienced by locking my computer, and losing Plex server if power goes out. I may look at testing this myself on a snow day.

I’m not OK with auto-login security wise (those of you who save passwords in your browser, a 1-min lockout isn’t going to protect from a burglar who takes your computer then wants to access your mail, Facebook, or other passwords saved in a browser so they can hijack your credit or accounts).

So another 9 months and still no word on what the Devs are doing about this, which rather suggests the answer is nothing.

Why is it always the case with software products that the users/customers are left desperately asking for some obvious features while the developers completely ignore them and conjure up ever more fancy features that NO-ONE is asking for.

Docker looks interesting, but it’s another kludge to try and make a server product (the clue is in the name - PMS) actually run as a server. This is something that needs to be fixed at source, i.e. the Plex Devs need to address this and get it right.

Why haven’t we filed this as a BUG? This is so outside the behavior norms, its really not a feature. I know Arch/Dev/PMs can argue this endlessly, but this is silly. These posts go back more than FIVE years. This is not difficult stuff, and is standard issue environmental configuration for the developer or DevOps engineer on MacOS.

Most of the people here - do not use the product because it cannot restart itself. Its NAME is “PLEX Media Server”. To everyone in this discussion - it means this is a persistant service, ergo - its a daemon.

at the VERY LEAST someone could write an official tutorial on how to make this work.

@Darwinner solution worked perfectly fine for me.

Those having trouble are probably missing steps in configuration (as @UKenGB points out as a possibility). Specifically, I think its just a general lack of understanding for how MacOS daemon and agent processes work (which I wouldn’t expect to be that common anyway).

if you are creating a _plex user from MacOS System preferences, it would make it UID > 500 like @UKenGB stated, but it’s group would most likely be staff. This is a problem because the supplied plist sets the group to _plex and permissions starting the daemon will be wack/totally broken.

I experimented with both UID > 500 and UID < 500 and results were the same as long as the group was what was expected for that user. I’ve actually been running this under an already existing user for a little while too. Didn’t feel a need to use a _plex user for my use-case.

So to that end, if you’re trying to get a daemon running for plex, make sure your explicitly setting the UserName and GroupName in the plist. If you don’t know the group of the user you’re using, run this in the terminal and look for what is listed in () of gid for your expected user.

# If my user in question is `cool_plex_user`
$ id cool_plex_user
# Output: uid=501(cool_plex_user) gid=20(staff) ...
# this users group is `staff`

# OR get the details of the currently logged in user (if thats what you want to use)
$ id $(whoami)

Then put that in the plist under UserName:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>KeepAlive</key>
	<dict>
		<key>SuccessfulExit</key>
		<false/>
	</dict>
	<key>Label</key>
	<string>tv.plex.service</string>
	<key>ProgramArguments</key>
	<array>
		<string>/Applications/Plex Media Server.app/Contents/MacOS/Plex Media Server</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
	<key>StandardErrorPath</key>
	<string>/tmp/tv.plex.service.err</string>
	<key>StandardOutPath</key>
	<string>/tmp/tv.plex.service.out</string>
	<key>UserName</key>
        <string>cool_plex_user</string>
        <key>GroupName</key>
        <string>staff</string>
</dict>
</plist>
1 Like

I can confirm that using @jjcarstens .plist that PMS can be started as a daemon unfortunately it appears that PMS cannot run without a logged in user. The error message in /tmp/tv.plex.service.err is

2018-03-13 08:27:31.086 Plex Media Server[11059:1845304] NSNotificationCenter connection invalid 2018-03-13 08:27:33.370 Plex DLNA Server[11065:1845456] NEPTUNE_LOG_CONFIG not found in 'Info.plist' _RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.

So it appears that starting PMS as a daemon at startup is pointless while it requires a logged in user with a desktop to connect to.

Starting PMS with an autologon user with a very short timeout looks like a solution albeit flawed.

The other possibility must be docker which would allow PMS to run as a proper server background process in a docker container.

Turns out that Docker isn’t the answer either as bizarrely that too like PMS requires a logged in interactive user who can click on the Docker.app which then pointlessly hides up in the toolbar just like PMS.

I think that I have finally solved the problem by creating a Linux VM under VMware Fusion & running PMS there. The VM can be started from a command line script without a UI so should be able to run at boot time without user intervention.

My solution is switch to running linux. Apple is planning on massively crippling MacOS Server and removing all the serious network server capability (like Mail, DNS, DHCP etc) in favour of remote Mac control (no use to me whatsoever) so I’m going to switch everything to running on Linux instead.

However, that’s not a solution for everyone, many of whom need to run PMS on a Mac and it disappoints me that the Plex developers first of all got it so badly wrong by not allowing MacOS PMS to run as a server process, despite calling it Plex Media SERVER and then refuse to even comment on the cries for help from users who require this facility.

In this instance I’m running High Sierra on a Hackinosh. It’s an HP Prodesk 400 G1 with an i3-4130 & 8GB RAM & 320GB disk. It only cost me £100 delivered used off eBay & is well built & very smooth & snappy. My original intention was to run Linux on it natively as my PMS but I installed MacOS just for fun & was so impressed I thought that I would keep it which is when I discovered the shortcomings of PMS on Mac. I still may revert to running Linux natively but thought that I would give VMware Fusion 10 a good trial. I have version 8 running on my Mac Pro so am eligible for an upgrade for under £50.

Just in case anyone else uses VMware Fydion to create a VM a word of warning. I created a couple of VMs to play with one was Ubuntu Desktop & the other was Ubuntu Server. Both worked well for running PMS & can be started headless (Google “vmrun nogui”) so started at boot from a script. However… I noticed during the course of yesterday evening that my whole home network had slowed to a crawl. I stopped the VMs but there was no change. I then shut down the host Hackintosh that fixed the problem. I then realised that VMware by default creates a VM in a folder within the users Documents folder. If you are using iCloud then by default it synchs your Documents folder to iCloud so I had a 20GB & a 13GB file being uploaded & swamping my Internet bandwidth. Stopping syncing cured the problem.

I am running PMS in a VM with 2 CPU cores & 2GB RAM mounting my Google Drive with rclone cache. The host is an HP Prodesk 400 G1 with a i3-4130 & 8GB RAM running High Sierra. Performance is excellent & far exceeds that of any VPS I have used

New here and working toward a usable setup. Have a Mac Mini I was planning on using, but don’t want hassle of logins.

If I’m not using the Mac for anything else, would auto-login using an account not linked to iCloud/Keychain/Etc. have security issues? That’s not ideal, because I would like to use the Mac personally also from time to time.

Second was surprised after seeing @jjcarstens solution that it was reported at not really working given how confident they were. What’s the point of the plist if one must login anyway to another account?

Finally, since it’s been a few more months has the issue seen any attention from Plex devs?

FWIW, I’m still on the fence between using Plex and just infuse. Balance of pros/cons isn’t clear yet for me.

I just have PMS on my main account on Mac and use auto login.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.