com.apple.nsfd prevents sleep

Often you’ll see that your Mac doesn’t want to go into sleep mode, but stays awake or awakens itself from sleep after a while without going back to sleep mode again. With newer version of macOS this might be caused by the nfsd (network file system daemon, Wikipedia). You can check this by running

pmset -g assertions

and you may find an entry like

PreventUserIdleSystemSleep [...]com.apple.nfsd[...]

This means that a running nfsd prevents your Mac from going to or staying in sleep mode. As newer versions of macOS have a feature called “System Integrity Protection”, which prevents a user from altering system and other important files, even as a root user, you cannot simply disable the NFS daemon. A way that involves a couple of steps, but yielded the best overall results is as follows:

  1. Make sure you do not actually need NFS
  2. vi /etc/exports
    delete all entries from that file or comment them out (dG), save and exit (:wq!)
  3. Reboot your Mac into Recovery Mode
    Press cmd+r while rebooting until the white Apple logo appears on the screen
  4. Open Terminal in Recovery Mode and disable “System Integrity Protection”:
    csrutil disable
    You can check whether you successfully disabled the “System Integrity Protection” by issuing:
    csrutil status
  5. Exit from Terminal
    exit
  6. Reboot into macOS, open Terminal.app
    sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.nfsd.plist
  7. Exit from Terminal.app
    exit
  8. Reboot into Recovery Mode
    Press cmd+r while rebooting until the white Apple logo appears on the screen
  9. Open Terminal in Recovery Mode and disable “System Integrity Protection”:
    csrutil enable
    You can check whether you successfully enabled the “System Integrity Protection” again by issuing:
    csrutil status
  10. Exit from Terminal
    exit
  11. Reboot into macOS, open Terminal.app
    pmset -g assertions
    Now there should be no entry of nfsd preventing your Mac from going into sleep mode Seite neu erstellt