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!

zeeple
  • 1,669

2 Answers2

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
RexYuan
  • 247
benwiggy
  • 35,635
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.

user3439894
  • 58,676
  • Please add further details to expand on your answer, such as working code or documentation citations. – Community Aug 31 '21 at 08: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. – user3439894 Aug 31 '21 at 12:02
  • @user3439894 Thanks. When converted to XML they show up as TRUE and FLALSE. Interesting. – nohillside Aug 31 '21 at 12:18
  • @nohillside, Also, using /usr/libexec/PlistBuddy they show as: <integer>0</integer> – user3439894 Aug 31 '21 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 '22 at 17:53