# Script to configure trackpad settings on macOS devices

The trackpad on a Mac replaces the need for a conventional mouse and allows interaction through various gestures and movements. Aimed at enhancing user convenience, macOS offers a wide range of customizable options on Trackpad, including Multi-Touch Gestures and Scroll & Zoom settings. A macOS user can manually configure the Trackpad settings by accessing ***System Preferences > Trackpad***. Alternatively, the administrators can execute the scripts given in this doc using the [Execute Custom Script](https://www.hexnode.com/mobile-device-management/help/how-to-run-scripts-on-mac-using-hexnode-mdm/) action to customize the trackpad configurations for macOS users.

Scripting language – Bash

File extension – .sh

 Disclaimer: 
The sample scripts provided below are adapted from third-party open-source sites.

 

 Notes:- The following scripts will act on the currently logged-in user.
- The user will be logged out of their accounts on deploying these scripts. They will have to log back into the device.

 

Configure Tap to click
----------------------

By default, the **Tap to click** setting is turned on and the users can tap on the trackpad to perform a click. However, if it is deemed to cause accidental taps leading to unintended actions, you may deploy the following script to turn it off. It enforces the end-user to click on the trackpad (instead of tapping) to initiate an action.

Script to disable tap to click on macOS devices

\#!/bin/bash loggedInUser="" loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'` su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "Clicking" -bool false" launchctl bootout user/$(id -u $loggedInUser) 

   1

2

3

4

5

  \#!/bin/bash 

loggedInUser=""

loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`

su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "Clicking" -bool false"

launchctl bootout user/$(id -u $loggedInUser) 

   

 

  

You can enable Tap to click, using the following script.

Script to enable tap to click on macOS devices

\#!/bin/bash loggedInUser="" loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'` su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "Clicking" -bool true" launchctl bootout user/$(id -u $loggedInUser) 

   1

2

3

4

5

  \#!/bin/bash 

loggedInUser=""

loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`

su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "Clicking" -bool true"

launchctl bootout user/$(id -u $loggedInUser) 

   

 

  

Configure trackpad scrolling
----------------------------

You can take advantage of the **two-finger scrolling** feature on a Mac trackpad, which enables you to effortlessly scroll up or down a page without the need to manually drag the scrollbar. It is enabled by default, but if you prefer to disable it, you can do so using the following script.

Script to disable trackpad scrolling on macOS devices

\#!/bin/bash loggedInUser="" loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'` su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "TrackpadScroll" -bool false" launchctl bootout user/$(id -u $loggedInUser)

   1

2

3

4

5

  \#!/bin/bash 

loggedInUser=""

loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`

su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "TrackpadScroll" -bool false"

launchctl bootout user/$(id -u $loggedInUser)

   

 

  

To enable trackpad scrolling, deploy the following script.

Script to enable trackpad scrolling on macOS devices

\#!/bin/bash loggedInUser="" loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'` su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "TrackpadScroll" -bool true" launchctl bootout user/$(id -u $loggedInUser)

   1

2

3

4

5

  \#!/bin/bash 

loggedInUser=""

loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`

su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "TrackpadScroll" -bool true"

launchctl bootout user/$(id -u $loggedInUser)

   

 

  

Configure trackpad momentum scrolling
-------------------------------------

**Momentum scrolling** is a feature that allows users to flick the trackpad with their fingers resulting in a smooth scroll through content. It is enabled by default, but if you prefer to disable it, you can use the following script.

Script to disable momentum scrolling on macOS devices

\#!/bin/bash loggedInUser="" loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'` su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "TrackpadMomentumScroll" -bool false" launchctl bootout user/$(id -u $loggedInUser)

   1

2

3

4

5

  \#!/bin/bash 

loggedInUser=""

loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`

su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "TrackpadMomentumScroll" -bool false"

launchctl bootout user/$(id -u $loggedInUser)

   

 

  

To enable momentum scrolling, use the following script.

Script to enable momentum scrolling on macOS devices

\#!/bin/bash loggedInUser="" loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'` su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "TrackpadMomentumScroll" -bool true" launchctl bootout user/$(id -u $loggedInUser)

   1

2

3

4

5

  \#!/bin/bash 

loggedInUser=""

loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`

su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "TrackpadMomentumScroll" -bool true"

launchctl bootout user/$(id -u $loggedInUser)

   

 

  

Configure Look up using trackpad
--------------------------------

**Look up** gives you the ability to quickly access definitions, thesaurus entries, and other information about a selected word. With a trackpad, you can do so easily by tapping with three fingers on the selected word. It is enabled by default, but if you prefer to disable it, deploy the following script.

Script to disable look up using trackpad on macOS devices

\#!/bin/bash loggedInUser="" loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'` su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "ForceSuppressed" -bool true" launchctl bootout user/$(id -u $loggedInUser) 

   1

2

3

4

5

  \#!/bin/bash

loggedInUser=""

loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`

su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "ForceSuppressed" -bool true"

launchctl bootout user/$(id -u $loggedInUser) 

   

 

  

To let users use Look up using trackpad, you can deploy the following script.

Script to enable look up using trackpad on macOS devices

\#!/bin/bash loggedInUser="" loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'` su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "ForceSuppressed" -bool false" launchctl bootout user/$(id -u $loggedInUser) 

   1

2

3

4

5

  \#!/bin/bash

loggedInUser=""

loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`

su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "ForceSuppressed" -bool false"

launchctl bootout user/$(id -u $loggedInUser) 

   

 

  

Configure Drag Lock
-------------------

**Drag Lock** allows users to drag and drop items without holding down on the trackpad. To use Drag Lock, simply tap the trackpad twice and drag the item you want to drag, and then tap it again to drop the item. It is disabled by default. You can deploy the following the script to enable it.

Script to enable Drag Lock on macOS devices.sh

\#!/bin/bash loggedInUser="" loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'` su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "Dragging" -bool true" su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "DragLock" -bool true" launchctl bootout user/$(id -u $loggedInUser) 

   1

2

3

4

5

6

  \#!/bin/bash 

loggedInUser=""

loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`

su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "Dragging" -bool true"

su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "DragLock" -bool true"

launchctl bootout user/$(id -u $loggedInUser) 

   

 

  

Deploy the following script to disable drag lock.

Script to disable Drag Lock on macOS devices.sh

\#!/bin/bash loggedInUser="" loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'` su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "Dragging" -bool false" su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "DragLock" -bool false" launchctl bootout user/$(id -u $loggedInUser) 

   1

2

3

4

5

6

  \#!/bin/bash 

loggedInUser=""

loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`

su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "Dragging" -bool false"

su -l "$loggedInUser" -c "defaults write "com.apple.AppleMultitouchTrackpad" "DragLock" -bool false"

launchctl bootout user/$(id -u $loggedInUser) 

   

 

  

 Notes:- It is recommended to manually validate the script execution on a system before executing the action in bulk.
- Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.