13

I want to change the trackpad tap-to-click property from the command line. Graphically, I can do it by clicking System Preferences -> Trackpad -> Tap to Click. How can I do it from the command line?

I have tried:

defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -int 0
defaults write GlobalPreferences com.apple.mouse.tapBehavior -int 0

but these didn't work (with int as 1 and 0, with reboot). Am I missing some step? I have Macbook 5,1 Snow Leopard.

  • How do you know that those are the correct keys for the tap-to-click behavior? Have you diffed the relevant files before and after changing the preference in the system GUI? – CajunLuke Apr 9 '12 at 18:13
  • Both lines are instructions from google searches and the upperone is changed when I use gui. I also tried with -bool true/false as Clicking-key is actually boolean. Is there other places what I should tinker with? Like "allow-command-line-access = true"? – Juha Apr 9 '12 at 18:22
  • There's no allow-command-line-access setup; defaults should work. Have you checked boolean YES/NO or string true/false/yes/no? – CajunLuke Apr 9 '12 at 18:48
5

Got it to work. The correct format (for me) is:

defaults -currentHost write -globalDomain com.apple.mouse.tapBehavior -int 0

Change 0 to 1 if you want to enable the tap-to-click. This seems to be really sensitive to which version you are using. The commands in the question have worked for others.

Logout - login is required for this to work.

  • If you need to logout and login, what do you gain by avoiding Sys Pref GUI? – Tal Aug 9 '12 at 6:37
  • 1
    Do it for 100 computers/accounts after every upgrade (once per year). Command line automates banal tasks. – Juha Aug 13 '12 at 12:06
  • 1
    In addition to automation, it's a nice log of one's preferences. – cavalcade Oct 19 '14 at 5:44
2

I had the following in my .osx file:

# Enable tap to click (Trackpad) for this user and for the login screen
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
  • Doesn't seem to work with Mojave but given this was so long ago, I'm not surprised. – skube Jan 19 at 18:07

You must log in to answer this question.

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