Right click Big Sur 11.3

SCHARLES
New Contributor II

Hello,

I am looking for a script for activating the right click for an apple mouse.
Thanks for your help,

1 ACCEPTED SOLUTION

SCHARLES
New Contributor II

Thanks but it doesn't work under 11.3
Here is my script.
Thanks for your help,

#!/bin/sh
# Turn on right-click for mouse and trackpad
for USER_TEMPLATE in "/Library/User Template"/*
    do
    if [ ! "${USER_TEMPLATE}" = "/Library/User Template/__permissions.plist" ] 
    then
    /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.AppleHIDMouse.plist Button2 -int 2
    /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.AppleMultitouchMouse.plist MouseButtonMode -string TwoButton
    /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.AppleMultitouchTrackpad.plist TrackpadRightClick -int 1
    /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.driver.AppleBluetoothMultitouch.trackpad.plist TrackpadRightClick -int 1
    fi
    done


for USER_HOME in /Users/*
    do
        USER_UID=`basename "${USER_HOME}"`
        if [ ! "${USER_UID}" = "Shared" ] 
        then 
            if [ ! -d "${USER_HOME}"/Library/Preferences ]
            then
            mkdir -p "${USER_HOME}"/Library/Preferences
            chown "${USER_UID}" "${USER_HOME}"/Library
            chown "${USER_UID}" "${USER_HOME}"/Library/Preferences
            fi
            if [ -d "${USER_HOME}"/Library/Preferences ]
            then
                killall -u $USER_UID cfprefsd
                /usr/bin/defaults write "${USER_HOME}"/Library/Preferences/com.apple.AppleHIDMouse.plist Button2 -int 2
                /usr/bin/defaults write "${USER_HOME}"/Library/Preferences/com.apple.AppleMultitouchMouse.plist MouseButtonMode -string TwoButton
                /usr/bin/defaults write "${USER_HOME}"/Library/Preferences/com.apple.AppleMultitouchTrackpad.plist TrackpadRightClick -int 1
            chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/com.apple.AppleMultitouchMouse.plist
            chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/com.apple.AppleMultitouchTrackpad.plist
            chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/com.apple.AppleHIDMouse.plist
            chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/com.apple.driver.AppleBluetoothMultitouch.trackpad.plist
            fi
        fi
done

View solution in original post

4 REPLIES 4

PaulHazelden
Valued Contributor

I have a script that runs at first set up it has this in it...

/usr/bin/defaults write /Library/User Template/Non_localized/Library/Preferences/com.apple.driver.AppleHIDMouse.plist Button2 -int 2

You can also run it on the individual User Homes too

/usr/bin/defaults write <PATH/TO/USER/HOMEFOLDER>/Library/Preferences/com.apple.driver.AppleHIDMouse.plist Button2 -int 2

I did run this on an early version of BigSur on an Intel Mac, and it worked. But things might have changed since then, and I am not anywhere near one of my test Macs to be able to check it out.
The first one will add it to the Template, so any new users will get the change. The second, once you put in the correct path will change an individual user account.

SCHARLES
New Contributor II

Thanks but it doesn't work under 11.3
Here is my script.
Thanks for your help,

#!/bin/sh
# Turn on right-click for mouse and trackpad
for USER_TEMPLATE in "/Library/User Template"/*
    do
    if [ ! "${USER_TEMPLATE}" = "/Library/User Template/__permissions.plist" ] 
    then
    /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.AppleHIDMouse.plist Button2 -int 2
    /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.AppleMultitouchMouse.plist MouseButtonMode -string TwoButton
    /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.AppleMultitouchTrackpad.plist TrackpadRightClick -int 1
    /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.driver.AppleBluetoothMultitouch.trackpad.plist TrackpadRightClick -int 1
    fi
    done


for USER_HOME in /Users/*
    do
        USER_UID=`basename "${USER_HOME}"`
        if [ ! "${USER_UID}" = "Shared" ] 
        then 
            if [ ! -d "${USER_HOME}"/Library/Preferences ]
            then
            mkdir -p "${USER_HOME}"/Library/Preferences
            chown "${USER_UID}" "${USER_HOME}"/Library
            chown "${USER_UID}" "${USER_HOME}"/Library/Preferences
            fi
            if [ -d "${USER_HOME}"/Library/Preferences ]
            then
                killall -u $USER_UID cfprefsd
                /usr/bin/defaults write "${USER_HOME}"/Library/Preferences/com.apple.AppleHIDMouse.plist Button2 -int 2
                /usr/bin/defaults write "${USER_HOME}"/Library/Preferences/com.apple.AppleMultitouchMouse.plist MouseButtonMode -string TwoButton
                /usr/bin/defaults write "${USER_HOME}"/Library/Preferences/com.apple.AppleMultitouchTrackpad.plist TrackpadRightClick -int 1
            chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/com.apple.AppleMultitouchMouse.plist
            chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/com.apple.AppleMultitouchTrackpad.plist
            chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/com.apple.AppleHIDMouse.plist
            chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/com.apple.driver.AppleBluetoothMultitouch.trackpad.plist
            fi
        fi
done

thebrucecarter
Contributor II

Greetings all,

Apologies for resurrecting an old thread, but we just got a request to implement the secondary mouse click in one of our labs.  Can anyone tell me offhand if this still works in Monterey (12.6 specifically)?  Was this ever exposed as an option in the Jamf GUI?  Appreciation in advance.

I have my script running and can set the right click up no problem. I have just checked a Mac I built yesterday with 12.6, and I have checked a M1 mac running 12.6 and it too has the right click set.
Not seen it as an option in Jamf, but that does not mean it isnt there.