Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I occasionally see howtos that allow you to change the functionality of some applications on OSX using defaults in the command line. I know that people find these configuration directives through scanning the application. How is that done?

fix: could have sworn it was option. My bad.

share|improve this question
Do you mean defaults? – Daniel Beck Sep 7 '11 at 19:02
Are you talking about graphical applications or UNIX applications? – peelman Sep 7 '11 at 19:19
Graphical / .app – kylehotchkiss Sep 7 '11 at 19:30
up vote 4 down vote accepted

You can use defaults to not only change these values, but also to list them.

defaults read -g show "global" options, while defaults read show the defaults (i.e. configuration options) for a particular program. In this context, is the bundle identifier of the program, e.g. or com.culturedcode.Things. More on this.

For example, run defaults read and you will find a line that says AppleShowAllFiles = FALSE or something similar. Now be adventurous and run defaults write AppleShowAllFiles -boolean TRUE and restart Finder to see what happens.

For more information how to use defaults, enter man defaults to view its documentation. It can become quite complex, and some things related to lists and dictionaries are pretty much impossible to do. Once you get that far, look up /usr/libexec/PlistBuddy -- there are some examples how to use it on this site, just use the search function.

Find out a particular program's bundle identifier:

To find out what your application uses for com.vendor.yourapp, right-click the application bundle, select Show Package Contents, navigate to Contents, open Info.plist using a text editor, or better a property list editor like Property List Editor or Xcode 4 (both part of Apple's developer tools) and look for CFBundleIdentifier or the like.

Another tool you can use is strings. It will display all strings (i.e. possibly useful sequences of characters) in a binary file. Note that this yields tons of false positives, since Objective-C function calls are also shown, as well as regular output that is shown on the UI.

Secrets also offers a database of hidden settings for OS X, sorted by application. These can be changed by using defaults. For your convenience, you can also download a Preference Pane from the website, which allows you to change these over your System Preferences.

share|improve this answer
Top notch answer Daniel. Thanks! – kylehotchkiss Sep 7 '11 at 19:31

# find key names in ~/Library/Preferences/`osascript -e 'id of app "iTunes"'`.plist
defaults read | ruby -e 'puts^    \"?([a-zA-Z_.\-]+?)\"? /)' > keys.txt

# extract identifiers from a binary
# (the output is tens of thousands of lines even after grepping)
strings - /Applications/ | egrep "^[a-zA-Z][a-zA-Z_.\-]{7,}$" | ruby -e 'puts"\n").uniq' > strings.txt

# the identifiers for preferences often appear near each other
for x in `cat /0/keys.txt`; do
    grep -C 10 "$x" strings.txt
done | ruby -e 'puts"\n").uniq' > strings2.txt

Another method using the GNU debugger:

share|improve this answer
Like the expansiveness of this. Thanks! – kylehotchkiss Sep 13 '11 at 18:38

You must log in to answer this question.

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