20

I want to know all keys (property list) which available on certain domain application, as example I could list available key for com.apple.dock by entering this command:

$ defaults read com.apple.dock

but somehow the output of this command only showed the active property list key, and yet not all available key for com.apple.dock listed there.

Anyone can help me on this?

5
  • Do you mind if I reword this. You are asking about the tool that writes messages and not about how to reverse engineer the program that reads the messages. By default, the program ignores anything you put in defaults that it wasn't expecting to see. You could embed shakespeare in the finder prefs and it would happily do nothing as long as it was valid plist XML once written to the file.
    – bmike
    Aug 16, 2011 at 22:18
  • @bmike I realize this. What I was interested in was the list of values that the application actually utilizes. I thought there might be a complete listing tucked away somewhere in a master config file inside Apps.
    – awesomo
    Aug 17, 2011 at 16:26
  • The list of values only exists in the source code for each program. Do you have one program you are interested in? Once they get compiled, the string keys in the binary are encoded and all mixed up with the other strings. There's nothing preventing the author of a Program from including a list as it could easily be added to the Contents/Resources folder that exists in any given Application. In practice, this isn't widely done.
    – bmike
    Aug 17, 2011 at 18:43
  • You can also diff the output of defaults read to find the keys for normal preferences or use the CFPreferencesCopyValue method in gdb. See How to explore more defaults write tweaks on OS X? - Super User.
    – Lri
    Aug 26, 2012 at 19:28
  • You could also diff the output of defaults read to find the keys for normal preferences, run strings on the binaries of frameworks, or use the CFPreferencesCopyValue method in gdb. See How to explore more defaults write tweaks on OS X? - Super User.
    – Lri
    Aug 26, 2012 at 19:29

6 Answers 6

8

This is not a trivial task, if I recall correctly people run the strings utility at the command-line against an Application, and look for things that match a structure similar to com.domain.FeatureName. (com.apple.iTunes, ch.cyberduck.CyberDuck, com.panic.Coda, etc.)

The likely easiest way to manage these overrides is by a System Preferences Pane by the name of Secrets. Using this installs a Preference Pane into System Preferences, and gives you an interface into choosing an application and changing their settings to your particular preference.

1
7

Found a website dedicated to these Mac OS X defaults write commands, some handy commands for Mac OS X Lion & Mountain Lion.

http://www.defaults-write.com

5

There really isn't a notion of "available" keys. The application is free to read whatever keys it wants. Most people discover "secret" defaults keys by using strings to look through the application binary to see what keys it will try to read.

3
  • yes, this is exactly that i want to find, "secret" defaults keys. Could you explain further about "secret" key? It very helpful if there any example. Thank you very much.
    – wongacid
    Aug 4, 2011 at 8:22
  • 1
    Many well-known examples are listed at secrets.blacktree.com
    – jtbandes
    Aug 4, 2011 at 8:38
  • Thanks!! let me know if you had any other great link on this kind of info. :-)
    – wongacid
    Aug 4, 2011 at 15:19
4

Most people here want to do everything via the command line, but I have a more practical suggestion.

These two programs described below list a great deal of the known command-line customizable features of Mac OS X applications, sorted by application or function. The advantage is the list of functions is provided for you; you don't have to go searching Google to find out what the functions are and the command-line sequences needed to modify each one.

There are several freeware or commercial applications that provide a graphical user interface listing most all of the customization options that can be modified via the Terminal. To activate any of these features, using these progams I'm describing, you do it within the application's GUI and you have no need to use the command line at all. You don't need to know anything about defaults write or .plist files.

Two of these apps are:

TinkerTool

which is free, and

MacPilot

which has just been updated with new Lion features, and costs US $20.00.

These are programs that I own and use.

Download the free TinkerTool and the trial version of MacPilot and and click through all the tabs to see all the myriad features you can customize. There are too many to list here.

enter image description here

enter image description here

Update

Developer Frederik Wiker has released freeware apps (donations accepted) for creating defaults write customizations specific to Lion and Mountain Lion; many of them also work fine for Mavericks (Mac OS X 10.9) as well.

Download these and see what customizations are available to you.

Lion Tweaks

Mountain Tweaks

enter image description here

2
  • Thanks for the recommendations. I appreciate the alternative approach.
    – awesomo
    Aug 17, 2011 at 16:29
  • You should really accept this/Wheat's answer. It's light years ahead of mine. Aug 17, 2011 at 19:08
3

Perhaps a fairly long explanation how things work might clear up your and others' search for these "hidden" preferences.

Most applications will read their preference files once when they start and the defaults tool exists to ensure the preference files are a valid structure and don't contain syntax errors. (It also allows the system to change how the keys are stored and people don't have to know the implementation details and can use the defaults command to do all the reading and writing.)

English language style and grammar guides ensure the words I type here are meaningful to the average english speaker, and standardizing the defaults system sets a framework so everyone knows what to expect. The preference list formatting is far more rigid and mathematical than a human language, but the concepts are similar.

The the Mac OS X user defaults system is a key value store (or database if you prefer).

You can write anything into these preference key value stores, a Shakespeare sonnet, numbers, a shopping list. If the program is coded to look for a specific key, it will read the value stored. If it's not looking for that key - it's value sits there unused and unread.

This brings up how to know what values a specific program might be looking for when they start up. It boils down to you either have to know the value or reverse-engineer the program.

Many tools exist to look into a program and try to figure out what strings (the keys) are embedded, such as strings and dbx/lldb as well as linking in your own library to dump the internal structure of a specific program.

In practice, some things that are needed for testing are added in this "hidden" way so that you can't look over the program's preference pane and see these new features that are not ready for broad use. In a way, it's not at all simple to get a comprehensive list unless the author of that program releases the source code or otherwise documents these settings publicly.

When you read the defaults store for a particular app - you are just reading the "book" that was written when the app created it's default set or the settings that shipped with the Mac OS X. That is why you don't receive the exhaustive list of things that are realistically possible to change with that application.

2

As far as I know an application will only store a new key if it differs from its defaults, at least that's what my apps do.

This is not something that can be controlled easily as it is part of the User Defaults framework, as the app only tell user defaults what needs to be stored and it takes care of the rest.

I don't think that the information you are looking for is going to be easily obtained, sadly. It could be nice though to have access to this.

You must log in to answer this question.

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