MacOS – Unable to toggle natural scrolling direction

defaultsmacosplistsystem-prefs

I've been experimenting a bit when trying to write a script for toggling the scrolling direction; com.apple.swipescrolldirection.

There are plenty of examples of people doing this online, and several approaches worked for me. E.g the following, which turns natural scrolling off:

$ defaults read -g com.apple.swipescrolldirection
1

$ defaults write -g com.apple.swipescrolldirection -bool false

$ defaults read -g com.apple.swipescrolldirection
0

However, the above does not take effect immediately, one has to log off and on again for it to work.

To attempt to force the changes to take effect without logging out I attempted to kill my users cfprefsd process. This caused a new process to start up, but the changes did not take effect.

Now to my problem. It seems my experimenting has caused something to break, cause I'm no longer able to change my scrolling direction. Not even from the System Preferences gui:

System Preferences Mouse window

In fact, if I try to check 'Scroll direction: natural' it will uncheck itself. The exact same thing happens if I try to check 'Scroll direction: natural' in the 'Trackpad' window of System Preferences. And if I do $ defaults read -g com.apple.swipescrolldirection the value won't have changed.

Anyone got any ideas?

Thanks.

Best Answer

Use defaults write -g com.apple.swipescrolldirection -bool NO

If it's automatically checking itself in the GUI it's because you have a invalid value set, IE: -int 0/1 using the BOOL value will restore functionality.