Stuck on Screen Locked after screen sharing

I closed my MacBook without first exiting the remote screen sharing session, and it caused the remote computer to get stuck on the Screen Locked screen. But I could still access it over SSH.

What I tried

1. Killing the process. top showed “screensharing” at 100% CPU, so I tried:

sudo kill -9 {pid}

But it didn’t effect the screen.

2. Restarting screen sharing

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.screensharing.plist
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.screensharing.plist

Source

3. Restarting or stopping ARDAgent

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -restart -agent
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -stop

Source 1, Source 2

4. Giving up

None of these had any success, so I resorted to a forced reboot.

sudo reboot

Leave a Reply