Solution to the “Mac screensaver won’t start” problem

If you have a problem where your Mac/macOS screensaver won’t start, I hope to be able to help you in this article. The same problem happened to a friend, and after a LOT of research, we were able to work through it to get her Mac screensaver working again.

The short story of the problem — and solution — is that she had used Apple’s AirPlay to mirror her computer screen to her AppleTV. From what I can tell, after she did that, AirPlay doesn’t automatically shut itself off, and it was preventing the screensaver from starting.

The solution to her particular problem was to kill the AirPlay process running on her Mac. When we did that, the AirPlay process was automatically restarted, but when it starts running again it doesn’t interfere with the screensaver. The rest of this tutorial explains the process of troubleshooting the problem, which can go way beyond AirPlay.

Note: If you don’t care what’s causing the problem and you just want it to go away, you can try rebooting your Mac at this time. That might work.

Background

As a small piece of background to this general problem, it looks like what’s happening is that there is a process (application) running on your Mac that’s preventing your screensaver from starting.

One way to think of it is like this: Imagine that you’re watching Netflix on your Mac; you don’t want the screensaver to kick in right in the middle of a good movie, right? As programmers, what we do is toggle a little MacOS setting that lets us keep the screensaver from starting. This is what the Netflix programmers do, they tell MacOS to keep the screensaver from starting while a video is playing. AirPlay and other applications do the same thing.

When this becomes a problem is when that setting doesn’t get set back to the way it was before. This can happen because a programmer forget to set it back, or because the application crashed, or in the case of the example that follows, because the application was still running in the background.

Using the Mac Activity Monitor to see which process is “preventing sleep”

At first I thought we’d have to go to the Mac command line to solve this problem, but then I read that you can see which processes are “preventing sleep” by using the Mac Activity Monitor application. To see this, start the Activity Monitor by following these steps. First, click the Applications icon in your Dock, and then scroll down and click the Utilities folder:

The Utilities folder under Applications


Inside the Utilities folder, click the Activity Monitor icon:

The Activity Monitor app icon


This starts the Activity Monitor application, which looks like this:

The main Activity Monitor window
 

Change the Activity Monitor view

After starting the Activity Monitor, make sure the CPU tab is selected, as shown in the previous image. As the Activity Monitor runs you’ll probably see the processes jump around in the view. This is because by default, the view is sorted by the %CPU column. To stop things from moving around, click the header of the Process Name column. This sorts all of the processes alphabetically. (You may have to click it twice to sort it in order from A to Z, rather than Z to A.) The nice part of this step is that the processes will quit jumping around. When that column is sorted alphabetically it will look like this:

The MacOS Activity Monitor sorted alphabetically by Process Name


What you need to do next is add a column named “Preventing Sleep” to this view. To do that, right-click on any of the header fields. For example, right-click the Process Name name column header. This brings up the popup menu shown in this image:

Add the Preventing Sleep column


With this popup menu displayed, move to the bottom of it and select the Preventing Sleep menu item. This will cause a new “Preventing Sleep” column to be shown in the table, as shown in this image:

The Preventing Sleep column
 

Finding the process that’s preventing the screensaver from working

The thing to do now is to scroll through the Preventing Sleep column and look for the word “Yes.” If you have the same problem my friend had, one (or more) of these rows will show the word Yes instead of No. This means that the process that’s identified by that row is the one that’s stopping the screensaver from working.

As an example of what I mean, imagine that the “HP Device Monitor” row in this image had a Yes in the Preventing Sleep column:

Look for 'Yes' in this column

If there had been a Yes in that column, it would indicate that the HP Device Monitor is preventing the screensaver from running.

Fixing the problem

In my friend’s case the process that had Yes in the Preventing Sleep column was named “AirPlayUIAgent.” I don’t have an AppleTV so I don’t know much about AirPlay, so one possible solution to her problem was to find a way to turn AirPlay off.

That being said, the more general solution to the problem is to kill the offending process, with the help of the Activity Monitor. In the case of AirPlay, I felt comfortable that it would automatically restart after we killed it, so we took this approach. (I’ve been a Unix systems administrator since the 1990s, that’s how I knew that.)

To kill the AirPlayUIAgent process, we followed these steps. First, select the AirPlayUIAgent row in the Activity Monitor view (which is the “HP Device Monitor” row in my example). Next, click the Information icon at the top-left of the Activity Monitor window:

The Activity Monitor Information icon
 

This brings up a “process information” dialog that looks like this:

The Activity Monitor Information dialog
 

On this dialog, click the “Quit” button at the bottom. This will show a confirmation dialog that looks like this:

Activity Monitor quit process dialog
 

Click Quit on this dialog.

In the case of the AirPlayUIAgent process on my friend’s Mac, as soon as we went back to the main Activity Monitor window the AirPlayUIAgent immediately reappeared in the Activity Monitor table, and when it reappeared the Preventing Sleep column had switched from Yes to No. Technically what happened was that we killed the AirPlayUIAgent process; MacOS restarted the process with its default configuration; that default configuration does not prevent the screensaver from starting.

If you’re not comfortable quitting a process ...

If you’re not comfortable with killing/quitting a process, here are some other things you can try:

  • Once you see which process (or processes, if you have more than one) are marked Yes in the Preventing Sleep column, see if you can find another way to restart that process. For example, if I had known more about AirPlay I might have known that there was an AirPlay icon in my friend’s Mac menu bar, and it may have been possible to turn AirPlay off that way.

Restoring your Activity Monitor view

Before moving on, there are two things to do. First, make sure you look at every process listed in the Activity Monitor and make sure that none of them have a “Yes” entry in the Preventing Sleep column.

After you confirm that, you can remove the Preventing Sleep column from the view with these steps:

  • Right-click the Preventing Sleep column header
  • Move down to the Preventing Sleep item on the popup menu and de-select it

When you do that, the Preventing Sleep column should go away. You can quit the Activity Monitor now if you want, you shouldn’t need it any more for this problem.

Testing your screensaver

Once that column was changed to No, I assumed that the screensaver would work properly, but we went ahead and tested it to be sure. To do this we followed these steps:

  • Click the Apple icon in the Mac menu bar
  • Click the System Preferences menu item
  • Click the “Desktop & Screen Saver” icon
  • Click the Screen Saver tab
  • Select any screen saver in the column on the left. For instance, I scrolled to the bottom and selected the “Word of the Day” screensaver.
  • Just beneath that area, click the “Start after” drop-down menu and select “1 Minute”

After you do that, step away from the keyboard and mouse and let your Mac sit there. After a minute the screensaver should start. Once you’ve confirmed that it’s working properly, go ahead and set the “Start after” time back to whatever time you want it on.

Other possible problems

There are other possible problems that might keep your Mac screensaver from starting properly — such as a MacOS bug — but I suspect that something like this is the most common problem.

One other problem I inflicted on myself several years ago that seemed like a screensaver problem went like this:

  • Under the System Preferences there’s an Energy Saver setting.
  • In that window there are two tabs, one named Battery and one named Power Adapter.
  • In my case under the Battery tab I had the “Turn display off after” settings set to a very low value, something like 10 minutes.
  • Because the display would be turned off after 10 minutes and my screensaver was set to 30 minutes, the display would turn off before the screensaver had a chance to start.

Summary

If your Mac screensaver won’t start properly, I hope the instructions in this tutorial are helpful in getting your screensaver working again.