Is it possible to set Magic Trackpad option via Terminal?

Is it possible to set the magic trackpad options with the menu topics:

  • Point click,
  • scroll & zoom,
  • etc.

by using the Terminal?


Solution 1:

You can use defaults to edit property lists. But Magic Trackpads and laptop trackpads have different settings, and they are stored in different places in different versions of OS X.

Here's some commands from the .osx file by @MathiasBynens:

# Trackpad: enable tap to click 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

# Trackpad: map bottom right corner to right-click
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true
defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1
defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true

# Trackpad: swipe between pages with three fingers
defaults write NSGlobalDomain AppleEnableSwipeNavigateWithScrolls -bool true
defaults -currentHost write NSGlobalDomain com.apple.trackpad.threeFingerHorizSwipeGesture -int 1
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerHorizSwipeGesture -int 1

The first ones don't enable tap to click on the login screen in Mountain Lion. -currentHost wouldn't be needed in all cases. It modifies files in ~/Library/Preferences/ByHost/ that are specific to the current computer and have precedence over files in ~/Library/Preferences/.

You can diff the output of defaults read to find keys for preferences.

See also these questions:

  • How to map the bottom right Trackpad corner to right-click programmatically?
  • How to change tap to click using "defaults write" from command line?
  • Toggle Natural scrolling from command line with reload
  • How to apply written defaults to a Magic Mouse (com.apple.driver.AppleBluetoothMultitouch.mouse)?