1

In MacOS, in the Accessibility widget (in System Preferences) if you scroll all the way down to 'Mouse & Trackpad', and then click on the 'Trackpad Options' button, there is a by-default-unchecked box for 'Enable Dragging'. This option is what allows you to "tap and drag" a window around using its titlebar.

I need to know the command line for checking that box. Can anyone help? Thanks!

2 Answers 2

3

The easy way to find the plist key for a given preference is to open a Finder window of ~/Library/Preferences, set it to List View, sorted by Date Modified.

Then, set the preference and see what file gets modified.

From that, I get two almost identical files modified (on 10.14.5):

com.apple.driver.AppleBluetoothMultitouch.trackpad.plist
com.apple.AppleMultitouchTrackpad.plist

They contain the following relevant keys:

<key>DragLock</key>
<false/>
<key>Dragging</key>
<false/>
<key>TrackpadThreeFingerDrag</key>
<false/>

so you can set these keys directly with defaults:

defaults write com.apple.AppleMultitouchTrackpad Dragging -bool true
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Dragging -bool true

You can include three-finger dragging or Drag Lock, if that's what you want with similar commands.

Finally, run the following for the writes to take effect:

/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u
4
  • Didn't work for me on Mojave.
    – user87
    Nov 24, 2019 at 0:43
  • @sepehr Which bit? Which files were modified when you changed the prefs? Did the plists contain any relevant keys?
    – benwiggy
    Nov 24, 2019 at 8:36
  • Setting the keys directly with defaults. I haven't yet checked the plists to be honest.
    – user87
    Nov 25, 2019 at 10:36
  • Adding to this: According to this answer, you can make defaults write take effect without logout-login/restarting with activateSettings -u
    – RexYuan
    Oct 30, 2022 at 8:10
1

I recommend using -int type instead of -bool, so, the commands should be:

defaults write com.apple.AppleMultitouchTrackpad Dragging -int 1
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Dragging -int 1


Unfortunately the defaults command does not necessarily tell one the correct type the key is and one can easily mistake a 0 or 1 as a boolean instead of an integer, or visa versa, when using the, e.g., defaults read ... command.

Using PlistBuddy, as in the output below, one can see the target keys are integer, not boolean.

% /usr/libexec/PlistBuddy -x -c 'print :Dragging' ~/Library/Preferences/com.apple.AppleMultitouchTrackpad.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<integer>0</integer>
</plist>
% 
% 
% /usr/libexec/PlistBuddy -x -c 'print :Dragging' ~/Library/Preferences/com.apple.driver.AppleBluetoothMultitouch.trackpad.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<integer>0</integer>
</plist>
%

Note that in reading these two files with PlistBuddy, they are original and untouched having never been manually edited previously and therefore what's reported in the output is the proper type for the keys.

5
  • Please add further details to expand on your answer, such as working code or documentation citations.
    – Community Bot
    Aug 31, 2021 at 8:46
  • @nohillside, Having just checked the value of the mentioned keys in both of the mentioned PLIST files, using Xcode, the mentioned keys are defined as Number, not Boolean, so using -int is actually the correct and proper way to modify these keys. Aug 31, 2021 at 12:02
  • @user3439894 Thanks. When converted to XML they show up as TRUE and FLALSE. Interesting.
    – nohillside
    Aug 31, 2021 at 12:18
  • @nohillside, Also, using /usr/libexec/PlistBuddy they show as: <integer>0</integer> Aug 31, 2021 at 12:19
  • You can also find the type of a field by using defaults export <domain> - > tmp and check tmp to see the type
    – RexYuan
    Oct 25, 2022 at 17:53

You must log in to answer this question.

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