41

I'm running Mac OS X (think it's Snow Leopard - 10.6.7) on a Mac mini. I'm trying to connect remotely from an iMac (this has been working fine in the past, for some time). When I click "Share Screen..." in finder on the iMac, I (eventually) see the server's desktop, but it appears to be frozen. However, I've managed to determine (from closing the window and sharing screen again, on repeat) that it IS actually receiving input, just not updating the display.

I can ssh into the server, but how can I restart the screen sharing service?

5 Answers 5

64

I had the same trouble, and to a headless Mini also. This is what I found that worked…

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

I had the opportunity to install an SSD in my Mini, and did a clean install of Lion at that time, and the issue persisted.

I made an alias

alias fixscreen='sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.screensharing.plist &&  sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.screensharing.plist'
5
  • Thanks for this solution, was looking for it already for years!
    – t0r0X
    Commented Nov 2, 2014 at 19:41
  • Of course, you need ssh enabled on the server. Commented Nov 9, 2015 at 15:35
  • 1
    Works in MacOS High Sierra A+ 💯
    – a2f0
    Commented Dec 11, 2017 at 18:28
  • Just tried this on High Sierra (10.13.5) and it worked like a charm. Commented Jul 7, 2018 at 22:09
  • 1
    Works on Sonoma (14.4.1)
    – Tomasz
    Commented Apr 11 at 5:45
8

Using launchctl unload and launchctl load still works but the commands are now "legacy commands".

Here's a more recent approach that also works with a single command:

sudo launchctl kill KILL system/com.apple.screensharing

This instructs launchctl to kill the screensharing service and then launchctl automatically restarts it after it has exited.

3
  • Does that work on Snow Leopard, as the question asks about?
    – tubedogg
    Commented Oct 26, 2016 at 21:17
  • No, it doesn't work in Snow Leopard: "Unknown subcommand 'kill'"!
    – awado
    Commented Jan 23, 2017 at 11:28
  • 1
    Does this still work on macOS 14? I'm running the develop beta, and screen sharing is working but this service isn't running. Fails with No process to signal.
    – Carl Walsh
    Commented Sep 20, 2023 at 22:09
5

OK, managed to find the answer (or, at least, an answer; I'm not quite sure on all the details of this command):

$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -users admin -privs -all -restart -agent -menu

As always - be careful when you paste something into terminal - best to inspect the command before running it. Doubly so when sudo is involved.

1
  • I'm not clear about the relationship between ARDAgent (ie remote management) and just screen sharing. The the UI, you can tick Screen Sharing and NOT Remote Management but kickstarting ARDAgent remotely ticks Remote Management and NOT Screen Sharing (although it enables VNC). Does that make sense?
    – Toby
    Commented Sep 29, 2012 at 13:00
2

The launchctl kill command now returns an error on Sonoma beta (14.1 Beta (23B5067a)):

> sudo launchctl kill KILL system/com.apple.screensharing

Not privileged to signal service.

The launchctl kickstart command works ok though:

> sudo launchctl kickstart -kp system/com.apple.screensharing

service spawned with pid: 19278

EDIT: as of macOS 14.4 Beta 5, launchctl kickstart also won't work to restart screensharing.

Run ps to get the PID of ScreensharingAgent, then kill the PID:

> ps -Ac -o pid,comm | awk '/^ *[0-9]+ ScreensharingAgent$/ {print $1}'

9977

> kill 9977

ScreensharingAgent will restart automatically.

1
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review
    – Allan
    Commented Nov 5, 2023 at 8:16
1

Rather than restarting just the screen-sharing service, I would suggest remote restarting the Mac Mini. You can do this via SSH by typing in:

sudo shutdown -r now

This will not only restart the screen-sharing service but may also resolve the issue that caused it to act up in the first place.

1
  • 1
    Sometimes you need to use the big hammer. It is a valid tool and should not be downvoted just because it is not subtle. In my case to regain access to a remote login I had to restart the whole machine to clean up a failed icloud setup wizard.
    – BitByteDog
    Commented Mar 2, 2021 at 2:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .