16

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.

3
  • 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
    Commented Apr 9, 2012 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
    Commented Apr 9, 2012 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
    Commented Apr 9, 2012 at 18:48

2 Answers 2

7

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.

Alternatively, run

/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u
5
  • If you need to logout and login, what do you gain by avoiding Sys Pref GUI?
    – Tal
    Commented Aug 9, 2012 at 6:37
  • 2
    Do it for 100 computers/accounts after every upgrade (once per year). Command line automates banal tasks.
    – Juha
    Commented Aug 13, 2012 at 12:06
  • 2
    In addition to automation, it's a nice log of one's preferences.
    – cavalcade
    Commented Oct 19, 2014 at 5:44
  • Tested and works with MacOSX-Catalyst (10.15.7); Too bad this does not mention command to restart Track-pad app and/or driver (something avoiding need to logout/login).
    – Top-Master
    Commented Jun 13, 2022 at 18:20
  • Adding to this: According to this answer, you can make defaults write take effect without logout-login/restarting with activateSettings -u
    – RexYuan
    Commented Oct 30, 2022 at 8:10
1

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
2

You must log in to answer this question.

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