My school has a bunch of Macs that are always logged in as Guest and have very annoying default settings (natural scrolling, no secondary mouse button, etc), so I am trying to write a terminal script that will change all the settings to my liking. One thing I would like the script to do is set right-clicking on the mouse to the Secondary Button; for some dumb reason, both the left and right buttons are set to Primary Button by default. Is there any way for me to do this from Terminal?

I would also like the script to disable natural scrolling; however, the only terminal command I have found ("defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false" and some variants of the same thing) require the user to log out and back in to take effect. Given that I can manually disable natural scrolling in System Preferences without needing to log out, surely there must be a way to make the change instantaneously from Terminal, right?

Any help on either of these problems would be much appreciated!

1 Answer 1


AppleScript is a nice way to go !

tell application "System Preferences"
    reveal pane "com.apple.preference.mouse"
end tell
tell application "System Events" to tell process "System Preferences"
    tell checkbox 1 of window 1
    end tell
end tell

It works on Mavericks. It might need some modifications on older OS X because the UI of the mouse preferences changed.

You must log in to answer this question.

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