1

I used this link https://paulminors.com/how-to-speed-up-mouse-tracking-on-mac/ which has a bash line that updates your mouse speed (beyond the default maximum):

defaults write -g com.apple.mouse.scaling your_mouse_speed

However, in order to make it work, you need to restart, which is kind of a pain. I assume what it's doing is really to change the preferences pane or plist? Thus, there should be a way to reboot just the mouse or the process that draws from the mouse settings. For example, if you change your speech synthesis .plist, you just reboot the speech synthesis core using a terminal command like killall SpeechSynthesisServer

Is there a way to do this with the mouse settings? I can obviously restart, but I'd rather not since I want this to be a quick thing.

  • 1
    I suspect you would have to kill loginwindow which in older versions of macOS would just cause the UI to disappear momentarily, but these days that is a quick way to get logged out back the to login screen. – unknowndomain Aug 16 '18 at 15:20
1

I couldn't find a way to do it with terminal alone so I had to create an Apple Script.

I found a script here: https://stackoverflow.com/questions/1680775/setting-the-mouse-tracking-speed-via-applescript

However, this did not work for me in Mojave so I had change it a littler. I also changed it so that it accepts a parameter which it will then forward to the tracking speed slider.

on run (trackingValue)
--Open and activate System Preferences
tell application "System Preferences" to activate

--Attempt to change settings using System Events
tell application "System Events"
    tell process "System Preferences"
        try
            delay 1
            --Open the "Mouse" pane
            click menu item "Mouse" of menu "View" of menu bar 1
            delay 0.5
            tell window "Mouse"
                tell slider "Tracking speed" of tab group 1
                    set value to round of trackingValue rounding down
                end tell
            end tell
        on error theError
            --An error occured
            display dialog ("Sorry, an error occured while altering Mouse settings:" & return & theError) buttons "OK" default button "OK"
        end try
    end tell
end tell

tell application "System Preferences" to quit
end run

You can then run this via terminal by calling:

osascript /<SCRIPT_LOCATION>/<NAME_OF_SCRIPT>.scpt <TRACKING_SPEED_VALUE>

You will need to give your Terminal accessibility access for this to work.

You must log in to answer this question.

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