Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to be able to enable and disable screen sharing from the command line rather than through System Preferences. This is on 10.8.3

To enable screen sharing, I find I only need to change a dictionary value in the following plist:


To be precise, to enable screen sharing, I do the following:

sudo defaults write /var/db/launchd.db/ -dict Disabled -bool false

And that changes:

sudo defaults read /var/db/launchd.db/
    Disabled = 1;


sudo defaults read /var/db/launchd.db/
    Disabled = 0;

Fine. I see from this site that I need to then do this (not sure why):

sudo launchctl load /System/Library/LaunchDaemons/

Now if I want to disable screen sharing I try the reverse:

sudo defaults write /var/db/launchd.db/ -dict Disabled -bool true

I get:

sudo defaults read /var/db/launchd.db/
    Disabled = 1;

Which is good, but then I have no successful way to get launchctl, or whatever (not really sure) to re-read this plist.

I try

sudo launchctl load /System/Library/LaunchDaemons/

and I get:

nothing found to load

And indeed, despite the dictionary value for this screen sharing being properly set to indicate screen sharing should be off, well, I still can screen share in just fine.

So what is the proper way to disable screen sharing from the command line on 10.8.3?

share|improve this question
up vote 7 down vote accepted

To start screensharing:

sudo launchctl load -w /System/Library/LaunchDaemons/

To stop:

sudo launchctl unload -w /System/Library/LaunchDaemons/

The -w flag modifies the Disabled key as appropriate. It's best to let launchctl handle this, as the location where the config files are stored has changed a bit between OS versions.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.