Mac OS X never shuts down When trying to shutdown or restart my Mac it just keep on showing the spinning wheel with the white background. I have waited for at least 15 minutes but nothing happens.

When safe booting I can successfully shutdown OS X so I guess it is probably caused by a kernel extension.

How can I find out what is hanging the shutdown process?



Result of doing kextstat -kl | awk ' !/apple/ { print $6 } ':

com.rogueamoeba.InstantOn
com.globaldelight.driver.BoomDevice
com.intel.kext.intelhaxm
com.rogueamoeba.InstantOnCore
com.Cycling74.driver.Soundflower
org.pqrs.driver.KeyRemap4MacBook
foo.tun
foo.tap
org.virtualbox.kext.VBoxDrv
org.virtualbox.kext.VBoxUSB
org.virtualbox.kext.VBoxNetFlt
org.virtualbox.kext.VBoxNetAdp
Does it also happen when you log out? Did you already check system.log?

Is there a logout hook (sudo defaults read com.apple.loginwindow LogoutHook)? I guess not though, because normally when a logout hook does not terminate, there is a solid light gray screen without any process indicator.

You could try unloading the kernel extensions with sudo kextunload -b $bundleid before restarting. Or just move the kext bundles outside /System/Library/Extensions/ and restart once so the kernel extensions won't be loaded.

You could also try terminating different processes before logging out, or for example run for f in {~,}/Library/Launch{Agents,Daemons}/*.plist; do launchctl unload $f; done.