I had this problem the other day: my macbook pro was not sleeping when closing the lid.
I was 100% sure I have not modified any power settings nor installed new applications so I had to dig up a bit more.
Reading few websites about similar problems got me to a tool which helped me find the source of this problem.
The command pmset -g was showing me several applications that could prevent my system from going to sleep (line in red).
florians-MacBook-Pro:~ florian$ pmset -g System-wide power settings: Currently in use: womp 0 halfdim 1 sms 1 hibernatefile /var/vm/sleepimage gpuswitch 2 networkoversleep 0 disksleep 10 sleep 0 (sleep prevented by UserEventAgent, UserEventAgent, configd, backupd, backupd, mds_stores, AddressBookSourceSync) hibernatemode 3 ttyskeepawake 1 displaysleep 15 acwake 0 lidwake 1
However, it did not provided more details about them.
The proper command to get these details is pmset -g assertions:
florians-MacBook-Pro:~ florian$ pmset -g assertions 2017-01-14 01:15:38 +0200 Assertion status system-wide: BackgroundTask 1 ApplePushServiceTask 0 UserIsActive 1 PreventUserIdleDisplaySleep 0 PreventSystemSleep 1 ExternalMedia 0 PreventUserIdleSystemSleep 1 NetworkClientActive 0 Listed by owning process: pid 63(UserEventAgent): [0x00001b41000b852c] 00:06:53 BackgroundTask named: "com.apple.mds.0" Created for PID: 87. pid 63(UserEventAgent): [0x00001776000b84b5] 00:23:04 BackgroundTask named: "com.apple.backupd-auto" Created for PID: 257. pid 74(configd): [0x0000161a00078478] 00:28:53 DenySystemSleep named: "InternetSharingPreferencePlugin" pid 2151(backupd): [0x00001796000184bf] 00:22:32 PreventUserIdleSystemSleep named: "Time Machine backup" pid 2151(backupd): [0x00001796000b84be] 00:22:32 BackgroundTask named: "Time Machine backup" pid 2732(AddressBookSourceSync): [0x00001cdb00018554] 00:00:04 PreventUserIdleSystemSleep named: "Address Book Source Sync" Timeout will fire in 1796 secs Action=TimeoutActionTurnOff pid 330(mds_stores): [0x000019d1000b850b] 00:13:01 BackgroundTask named: "com.apple.metadata.mds_stores.power" pid 131(hidd): [0x00000f81000982b3] 00:57:02 UserIsActive named: "com.apple.iohideventsystem.queue.tickle.4294968500.11" Timeout will fire in 895 secs Action=TimeoutActionRelease Kernel Assertions: 0x108=BT-HID,MAGICWAKE id=503 level=255 0x8=BT-HID mod=01/01/1970, 02:00 description=com.apple.driver.IOBluetoothHIDDriver owner=BNBMouseDevice id=504 level=255 0x100=MAGICWAKE mod=01/01/1970, 02:00 description=en1 owner=en1 Idle sleep preventers: IODisplayWrangler
By looking at the details I found one process that I recently enabled: Internet Sharing.
That was it! Once I disabled the internet sharing, my macbook was able to sleep again!
If you are in the same situation, I hope these two commands above will help you find the way.