Specifications

Saving Text Files for UNIX Execution
When you edit text les for execution by UNIX utilities, you need to save the les
properly so that they can be used (or executed) by their calling program. It’s especially
important to use plain text and ensure that the privileges are correct.
Using plain text
Many graphical text editors, including TextEdit, save text les in a more complex
format than most UNIX programs expect. If you’re using TextEdit to edit text-based
conguration les, save them as Plain Text, not the default Rich Text Format. To change
the default format of text documents in TextEdit you have two options:
To save all documents as plain text, select “Plain text under Format in the New m
Document pane of TextEdit preferences.
To change the format of an individual document, choose “Make Plain Text from the m
Format menu.
Although Rich Text Format may appear to be simple text in an editor, its actually a full
specication that describes formatting, colors, fonts, and other information that isn’t
contained in the plain text les that most UNIX programs expect. To see what’s actually
contained in a Rich Text Format document, save one in TextEdit, and then open the
same le in a command-line text editor.
Editing Property Lists
Many preference and conguration les in Mac OS X use property lists (plists) to
specify the attributes, or properties, of an application or process. An example is the
Finder’s preferences plist in the Library/Preferences/ folder of a user’s home folder. The
le is named com.apple.Finder.plist. The default naming convention for a plist includes
the distributors reverse DNS name prepended to the application or process name,
followed by a“.plist extension.
Property lists are binary les that you can edit using the following tools:
Property List Editor is a graphical application that’s a part of the Xcode developer Â
tools. You can get the Xcode tools from developer.apple.com. Property List Editor is
most useful if you already understand property lists and their conventions.
 PlistBuddyPlistBuddy is a command-line tool for directly reading and modifying
values inside a property list without the need to convert the property list to an
intermediary format.
 defaults is a command-line tool that you can use to edit property lists.
The defaults command is a powerful tool, with functionality beyond simple editing
of property lists. When you know the specic key and value in a property list that
you need to change, it’s very ecient.
36 Chapter 5 Common Command-Line Tasks