How to change tap to click using "defaults write" from command line?

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.


Solution 1:

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.

Solution 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