What do I need to do to get the Mac to sleep properly

sleep-wake

My 2008 iMac/10.10.5 has recently refused to sleep… either automatically or with a menu command.

The internal HD failed some time ago, since which it's been running fine on an external usb hd.

No 'sharing' options are enabled.
'Wake for network access' is not enabled.
'Allow Bluetooth devices to wake…' is not enabled.
The issue also happens with a 'test' account.

SMC and NVRAM have been reset.

'pmset sleepnow', 'osascript -e 'tell application "System Events" to sleep'' and 'osascript -e 'tell application "Finder" to sleep'' immediately sleep the display but not the system.

The 'energy pane' of Activity Monitor doesn't show any apps preventing sleep.

I'd had an issue with 'addressbooksourcesync' preventing sleep, but think that's now sorted.

'pmset -g assertions' shows '0' for 'PreventUserIdleDisplaySleep' and 'PreventUserIdleSystemSleep'.

Assertion status system-wide:
   BackgroundTask                 0
   ApplePushServiceTask           0
   UserIsActive                   1
   PreventUserIdleDisplaySleep    0
   PreventSystemSleep             0
   ExternalMedia                  1
   PreventUserIdleSystemSleep     0
   NetworkClientActive            1
Listed by owning process:
   pid 195(cupsd): [0x0000004600110135] 00:10:00 NetworkClientActive named: "org.cups.cupsd"
   pid 49(powerd): [0x0000003c0008012c] 00:10:11 ExternalMedia named: "com.apple.powermanagement.externalmediamounted"
   pid 95(hidd): [0x000000a500090183] 00:08:25 UserIsActive named: "com.apple.iohideventsystem.queue.tickle"
    Timeout will fire in 218 secs Action=TimeoutActionRelease
Kernel Assertions: 0xc=USB,BT-HID
   id=500  level=255 0x4=USB mod=21/12/2016 12:46 description=EHC2 owner=AppleUSBEHCI
   id=501  level=255 0x4=USB mod=21/12/2016 12:46 description=EHC1 owner=AppleUSBEHCI
   id=503  level=255 0x4=USB mod=21/12/2016 12:52 description=UHC4 owner=AppleUSBUHCI
   id=506  level=255 0x4=USB mod=21/12/2016 12:55 description=UHC3 owner=AppleUSBUHCI
   id=507  level=255 0x8=BT-HID mod=01/01/1970 01:00 description=com.apple.driver.IOBluetoothHIDDriver owner=BNBMouseDevice

Best Answer

This is the key to the entire issue:

The internal HD failed some time ago, since which it's been running fine on an external usb hd.

It can't go to sleep when your USB is your boot drive. If it did put the port to sleep, it would unmount the boot device which would cause OS X to crash. You can confirm this with the line in your pmset output:

ExternalMedia 1

(The USB drive is, by definition, "external media")

If you replace your failed drive with a new internal drive or SSD, the problem will go away.

I had a failed drive in my iMac and I can understand why you have not yet changed out your drive. It's much easier than you think to replace it, it just takes some time. Even though ifixit rates it as "difficult", it's not difficult per se; it's time consuming and detail oriented. You have to do this very carefully.

Before you undertake this fix, make you you have all the parts you need like the drive and the adhesive strips. (Get quality ones and not generic double sided tape - I have seen people that went cheap here and had displays fall out - quality tape is much cheaper than a replacement display)

Have a look at ifixit.com for step by step instructions