how to uncheck and check sharing preferences

In the preferences pane under sharing I am trying to firstly uncheck “File Sharing”, then
check it back on again, can this be done with out UI scripting, using a shell script?

I am also under the “Options” window in sharing trying to check and un check “Share files and folders using SMB, and AFP”, I found the below on the web to check the above two, but I don’t no how to uncheck them

could some one please show me how it’s done, as I don’t no where else to look

Turns on AFP sharing

do shell script "/bin/launchctl load -w " & "/System/Library/LaunchDaemons/" with administrator privileges

Turns on SMB sharing

do shell script "/bin/launchctl load -w " & "/System/Library/LaunchDaemons/" with administrator privileges

been looking around and found that “load” check’s the box and “unload” unchecks the box


/bin/launchctl load -w


/bin/launchctl unload -w

Hi Budgie,

Have you tried using uielment scripting? Or is that not what you want to do?


Hi kel1

I’m trying to avoid ui scripts, and appear to have done so, the shell scripts I found seem to work fine, especially now I figured out how to use the load & unload terminology, toggles the check box’s perfectly.

Figured that if I unload both SMB and AFP the file sharing check box sets it’s self to unchecked.