'Show scroll bars' stuck on Always At one point, I connected a USB mouse to my MacBook Pro, which caused the scroll bars to always be shown in every app. This was despite my settings in Appearance.prefpane where ‘Show scroll bars’ was set to ‘Whilst scrolling’.

Since then, I have been unable to remove the scroll bars. Setting the option in the General preference pane to ‘When scrolling’ has no effect, and upon quitting and re-opening System Preferences the option is reverted to Always.

I have tried using defaults write -g AppleShowScrollBars -string WhenScrolling but this has no effect either. How can I set the scroll bar visibility to ‘When scrolling’?
I fixed this by editing the AppleShowScrollBars string in the ByHost .GlobalPreferences plist.

Even though ~/Library/Preferences/.GlobalPreferences.plist showed the correct value of ‘WhenScrolling’, the ~/Library/Preferences/ByHost/.GlobalPreferences.udid.plist had the value of "Always". By changing the string using Xcode and logging out, it was resolved.