1368 words on Mac OS X
Mac OS X is a reasonably nice operating system. But it does have its idiosyncrasies. For example, the OS thinks you want to hide the ‘extension’ part of a file name by default. Or it thinks that tiny print dialogues are more useful than large ones. And while the machine will remember your changes to these settings, it does so on a per-application basis in many cases and you will have to adjust things to meet your preference for each application you are using.
Unless you tweak things a little, that is. As most current Mac applications will use the OS’s defaults system for storing preferences, those are easy to adjust. You can view them by opening the ‘com.companyname.applicationame.plist’ files in your Library folder’s Preferences folder. And you can edit those files using the Property List Editor that is a part of Apple’s developer tools.
But there’s another, less pretty, and more powerful way of editing preferences. This requires you to use the Terminal and use the defaults
command. The defaults
command can do a number of things and the most useful ones are reading, writing and deleting settings. The command itself usually takes a form like this:
defaults verb application key [value]where the components work as follows.
This is also known as the domain of the defaults. There are various ways to specify it. The most common one is using the bundle identifier of the application whose defaults should be changed. This also happens to be the name (without the final .plist) of the application’s preference file.
Another option would be to use the -app
specifier and just give the name of the application whose preferences should be edited. This can be handy, but it has two problems: First, that application names are more likely to contain spaces than bundle identifiers (which can contain spaces but in practice rarely do); and thus application names can be hard to enter in the Terminal. Second, that application names can be localised and as a consequence the name the application shows you isn’t necessarily the same name the system uses for the application. This is particularly problematic if you are not using the system in English.
Yet another option is to explicitly give the path of the preference file you want to edit without the trainling ‘.plist’ part of the name. This can be handy if you want to edit a copy of a preference file that is not currently in the Preferences folder.
In short, to access the current preferences of your Font Book application, say, you can use either of these statements:
While what we have seen so far is great for very specific access to preferences, we still have a trump up our sleeve. And that’s the option to apply a preference globally. Which means that any application which does not have the preference set will get the globally set value as a default. To set such a global preference use the NSGlobalDomain specifier.
These global settings are stored in the file .GlobalPreferences.plist inside the Preferences folder of your Library folder. For reasons I do not understand, Apple chose to make that file invisible, although it contains some of your data.
NSFontPanelPreviewHeight
.
If you want to write data to the preferences, you have to specify the data’s type and the data itself. The data’s type has to be specified using a leading -. Common data types and usages are -string "Hello World"
, -integer 27
, -boolean YES
and -float 1.618
. It is usually a good idea to write data with the correct type as some applications don’t handle potential ambiguity well. If you don’t specify the data’s type, -string will be implicitly used.
While these are the most common options, plenty of advanced and hard-to-type options are possible as well. You can also add or add entrys to arrays and dictionaries as well as having the ability to provide a ready-made property list for insertion into the preferences.
Once you know this (or have read the manual page of the defaults
command line tool), all that remains to do is digging through your existing preferences and figuring out which of these are likely to be settings that stem from system-wide frameworks and can be used by many applications. The next step would be to isolate those keys and their preferred values and then using the defaults tool to write them to NSGlobalDomain so all applications which haven’t written their own preference for that setting yet will use your preferred value.
A final thing worth saying is that it is advisable to only use the defaults
command for manipulating an application’s settings when the application in question isn’t running. Doing otherwise will make it quite likely that the application overwrites your changes later on. (While the defaults system is good in the sense that it’s quite powerful and simple, it’s not good enough to keep applications informed about external changes. A shame, but we’ll have to live with it.)
So now we just need to find out a few keys that applications like to use. I’ll start you off with a small list here:
And that is that.
Once you are a X.5 user and have gotten into the spirit of using the defaults
command, you may also want to liberate your X.5 Dock of its fake perspective, wavy background, reflections and ugly shadows using
defaults write com.apple.dock no-glass -boolean YESAfter which you should kill the Dock using Activity Monitor or
killall Dock
as you’re using a Terminal window anyway. Bliss.
Is there a way to change the default line and paragraph spacing? And of the zoom factor?
Most programs do have settings for font and font size, but spacing is important too (it helps a lot when you copy and paste between different programs and those settings are the same).
Zoom is even more important … A 12pt font ist common for printing but pretty much unreadable when with the high resolution of modern displays. A default zoom would come very handy.
Thanks in advance.
Interesting questions, John. Unfortunately I don’t know an answer to them. Let’s hope somebody else does.