PLEX server should keep Mac awake after wake-on-lan

@MALmen @Lyrad87

Both scripts (old and new) are extremely simple. They entirely depend on what the Plex server chooses to write to its log files. So the key to diagnosing any problem is to view Plex’s log files while you browse your Plex library or watch a movie (see instructions below).

With the old script, as long as the Plex log file gets updated with any message when you browse your Plex library or watch a movie, then the script will prevent sleeping.

With the new script, the Plex log file must get updated with a message containing the words authenticated user when you browse your Plex library or watch a movie. If these words do not appear, it’s not going to work.

With my Plex installation, a message containing authenticated user always gets written when I browse/watch. However, on your Plex installation, those magic words may not appear. So the solution is for you to look at the Plex logs while you browse/watch, and see if you can pick out a word/phrase that always gets written to the logs. Ideally, that same word/phrase should not get written to the logs when you are not browsing/watching (i.e. when Plex is just doing its general background housekeeping stuff). This will avoid the script incorrectly keeping your Mac awake when you’re not browsing/watching Plex.

Once you’ve found a suitable word/phrase, you need to modify the new version of the PlexCaffeinate.sh script and replace the 2 occurrences of authenticated user with your magic word/phrase. Once you’ve made the change, you need to restart the script using the launchctl unload and launchctl load commands as per my earlier post.


To view the Plex log files, do as follows:

  1. From the Dock, click Launchpad > Other > Console

  2. In the Console application, on the left-hand side click the triangle to expand ~/Library/Logs then Plex Media Server then click on Plex Media Server.log (make sure you click the file with this exact name)

  3. Keep this window open, then browse your Plex library, or watch a movie. New messages should now continuously appear in the log in Console. Study these messages until you find a suitable word/phrase that keeps reappearing whenever you browse/watch Plex.