MacOS – My Dock won’t launch upon login

dockmacos

I recently installed the 10.10.5 update on my Macbook Pro, and now upon login with my home account, the dock won't launch (literally, there is no Dock process; killall Dock returns No matching processes belonging to you were found. Another command I've tried is sudo /System/Library/CoreServices/Dock.app/Contents/MacOS/Dock, and this returns 2015-09-16 10:26:35.219 Dock[1854:178195] __33-[WVSpaces _initializeFullscreen]_block_invoke: fullscreen message error: Connection invalid). In addition, several standard user interface elements, such as command-tab, spaces, and trackpad gestures, no longer work. When I login as a guest user, though, everything works just fine. I'm confused how to get these UI elements working again.

Edit: I've checked the system console, and it appears as if the dock is constantly trying to launch, but failing.

Best Answer

Sometimes the LaunchAgent (launchd job) that ensures that the Dock starts up gets stuck. Try unloading and re-loading it:

launchctl unload -F /System/Library/LaunchAgents/com.apple.Dock.plist
launchctl   load -F /System/Library/LaunchAgents/com.apple.Dock.plist
launchctl start com.apple.Dock.agent

The Dock is an app, and apps run as the current user, not as root. (To convince yourself that this is true, remember that each user has their own Dock.) So don't start it with sudo, unless you want to see the root user's Dock. You should be able to start it the way you did (except without sudo), given that the LaunchAgent is unloaded:

launchctl unload -F /System/Library/LaunchAgents/com.apple.Dock.plist
/System/Library/CoreServices/Dock.app/Contents/MacOS/Dock

The reason you need to unload the LaunchAgent is because it will reserve certain ports/services for use by the Dock process it's (unsuccessfully) trying to launch. This keeps your manually-launched Dock process from using them.