Macos – How to explore more defaults write tweaks on OS X

macososx-mountain-lionterminal

I would like to explore some new tweaks which can be done by the "defaults write" command in OS X(ML).

What can I do to find them out myself rather than hunting online for known tweaks?

Best Answer

Disclaimer: I’m the author of ~/.osx, a collection of defaults write settings. These are the techniques that I use to find settings. Let me know if there is a better/easier method I didn’t mention here!


For most non-hidden settings, this is how you can find the correct preference keys in Terminal.app:

defaults read > a
# Change the setting
defaults read > b
diff a b

For hidden settings, it gets trickier. You can use the command-line strings utility on any binary executable and see if any of the resulting text looks like a preference key. E.g.:

strings /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder

Here’s another example that will look through all .framework files in /System/Library/Frameworks/ and filter the output somewhat:

strings /System/Library/Frameworks/*.framework/Versions/Current/* /System/Library/Frameworks/*/Frameworks/*/Versions/Current/* 2> /dev/null | grep -E '^[a-zA-Z0-9_.-]{10,80}$' | sort | uniq

There’s also a tool called GDB which can be used to find hidden preferences.