Can I undo changes made via "defaults write"?
Solution 1:
Yes, usually you can just use defaults delete
If for example you have run
defaults write -g NSScrollAnimationEnabled -bool false
You can undo the changes by running one of
defaults delete -g NSScrollAnimationEnabled
defaults write -g NSScrollAnimationEnabled -bool true
(In all cases you need to restart the application to apply changes)
Even if the preference key had some value before you used defaults
it shouldn't matter if you delete the key.
It is generally safe to delete preference keys or even complete files, and they can usually be recreated by OS X or applications.
The property lists modified by defaults
are stored in directories like
~/Library/Preferences/
~/Library/Containers/com.apple.mail/Data/Library/Preferences/
~/Library/Preferences/ByHost/
You can edit a plist in a text editor after converting it to XML with
plutil -convert xml1 FILENAME