Where do these Terminal commands come from?

Solution 1:

Well, these commands edit .plist files in your /Users/xyz/Library/Preferences folder. So, if you look at these files, you can look at these files and base your Terminal commands after these.

These are XML-based files, so you can view them in a more readable format if you open them in Xcode, which is available in the Mac App Store.

In the Terminal, the format for these is "defaults write PLIST_FILE KEY -TYPE VALUE" where the PLIST_FILE is the name of the file in the Preferences folder without the .plist, KEY is the key that you can see in Xcode, -TYPE is the type of key that you can find Xcode (and you can find if there is an abbreviation for that type by typing "defaults" into the terminal), and value is the value you wish to set the key at.

Here are some of the string types from the Terminal:

-string <string_value>
-data <hex_digits>
-int[eger] <integer_value>
-float  <floating-point_value>
-bool[ean] (true | false | yes | no)
-date <date_rep>
-array <value1> <value2> ...
-array-add <value1> <value2> ...
-dict <key1> <value1> <key2> <value2> ...
-dict-add <key1> <value1> ...

Solution 2:

Per Nathan's answer, they simply modify features built into software though not necessarily obviously exposed or otherwise documented. Your example of the iTunes notifications is a great one, because there are no 'iTunes Playback Notification' options to speak of, but the fact that the feature exists and can be enabled means that someone inside of Apple was working on such a system.

Related, though not at all actually answering the question, check out Secrets. The site can be used to simply look up preference modification commands, but they also offer a downloadable Preference Pane that after installation you access via System Preferences, and offers a very friendly way to enter these commands instead of via the Terminal.

The always important caveat is doing this can enable potentially unstable or otherwise system altering functions. Please do your research before enabling any options and be absolutely sure of the entire effect of the option you're enabling.