I run a MacBook Pro with OS X 10.11. I've noticed the machine hasn't slept well last night. There were events logged every couple of seconds in system.log throughout the entire night that the lid was closed.

I think it might be that two processes are preventing sleep while on A/C.

# pmset -g
System-wide power settings:
sleep                10 (sleep prevented by UserEventAgent, UserEventAgent)

Can I stop these processes (or any other process) from preventing sleep?

  • Have you updated to OS X 10.11.6? – Graham Miln Aug 27 '16 at 10:55
  • What two processes do you think are preventing sleep? – Graham Miln Aug 27 '16 at 10:55
  • Yes 10.11.6 is installed. – Dex Aug 27 '16 at 11:09
  • UserEventAgent is running in two separate processes: one under normal user account, and the other under root. – Dex Aug 27 '16 at 11:09
  • 1
    What is the result of running pmset -g assertions? – Graham Miln Aug 27 '16 at 11:29

UserEventAgent suggests an input device was in active use. This may be a faulty mouse, keyboard, or other input device like a gamepad.

Try disconnecting all your externally connected devices and seeing if this behaviour continues.

Another cause may be a pet or vibrations causing a device to register movement.

Is Wake for network access enabled? See System Preferences > Energy Saver for this setting. Waking for network access will occasionally wake a sleeping Mac to examine and maintain the network environment.

Alternatively, consider using a third party tool to help put your Mac to sleep despite power assertions.

  • I don't have any input devices connected. BlueTooth is also off so there is no chance a neighbor's device is causing it. No pets either, and no vibrations (at least not possible to have had vibrations on the desk for 8 hours straight). – Dex Aug 27 '16 at 10:08
  • The setting "wake for wi-fi network access" is OFF. – Dex Aug 27 '16 at 11:12

There are dozens of things that can prevent sleep built into macOS, and third party software can also disable sleep.

The first troubleshooting step is to run this command in Terminal:

pmset -g assertions

That will list the reasons your Mac is not currently asleep. Normally running on battery power you should get:

Assertion status system-wide:
   BackgroundTask                 0
   ApplePushServiceTask           0
   UserIsActive                   1
   PreventUserIdleDisplaySleep    0
   PreventSystemSleep             0
   ExternalMedia                  0
   PreventUserIdleSystemSleep     0
   NetworkClientActive            0

[further details removed for brevity]

Which means the only reason your mac isn't sleeping is due to user activity on the mouse/keyboard.

If you see something else (like PreventUserIdleSystemSleep) then your mac probably won't sleep at all and you should read the other details provided by pmset -g assertions to investigate further.


In my case it was because I was running the iPhone emulator that comes with XCode. Closing the emulator down removed sleep prevented by UserEventAgent.

I only had one occurrence of UserEventAgent though. When I ran pmset -g I got this:

~$ pmset -g
System-wide power settings:
Currently in use:
 sleep                10 (sleep prevented by UserEventAgent)

In my case the culprit was a Bluetooth keyboard with low batteries. Recharging the batteries fixed the problem.

Actually I got what I deserved because I ignored the "Keyboard batteries low" notifications for a week. My MacMini got so upset (they don't like being neglected) that she could not sleep... :-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .