Tutorial: Preferences Files: The Complete Story (Part VI)

Tutorial: Preferences Files: The Complete Story (Part VI)

Ted Landau

Welcome back to the tutorial series that covers everything you ever wanted to know about preferences (.plist) files. So far, the series has explored what .plist files are, how to interpret the content of .plist files, how to edit these files (including working with "hidden" settings) and how to troubleshoot problems caused by .plist files. For all the details, see Parts I & II, Part III, Part IV and Part V.

Previous installments have focused mainly on .plist files found in their most common location: the Preferences folder of home directories (~/Library/Preferences). I did note that .plist files could be found in other locations (such as /Library/Preferences; see Part I), and provided a couple of examples of working with files in these other locations (such as the com.apple.loginwindow.plist and com.apple.AppleFileServer.plist files; see Part IV). But it was not the central theme. In this part, these additional .plist files locations get their moment in the limelight. We look at where these locations are and the function of the files in these folders.

One clarification before we get started: We have often referred to .plist files as preferences files. Indeed, "preferences" is in the title of this series. One reader took us to task for this, noting that "preferences files" and ".plist files" are not synonymous terms. This is true, as I explained in Part I. But it is worth re-emphasizing for this current discussion. In particular:

Technically, a .plist file is a property list file of a specific XML format (although it may also be saved as a binary file). A preferences file is, almost by definition, any file that stores the preferences settings for some software. In Mac OS X, most user-modifiable preferences settings are stored in .plist files in the ~/Library/Preferences folder or, to a lesser extent, in the /Library/Preferences folder. As such, I often refer to .plist files as preferences files. However, there are some preferences files in these folders that are not .plist files. And, more importantly for the current discussion, there are .plist files in other locations that are not really preferences files.

PART VI: What about .plist files beyond those in the ~/Library/Preferences folder?

Q. Remind me again. Why does Mac OS X need a Preferences folder in the /Library folder as well as in each ~/Library folder? And what files are located there?

A. The /Library/Preferences folder contains .plist files for settings that should remain the same regardless of which user is currently logged in.

For example, this is where Apple stores the serial numbers for QuickTime Pro (in com.apple.QuickTime.plist) and iWork (in com.Apple.iWork06.plist). This is why, when you create a new account on your Mac, you don't have to re-enter the serial numbers for the new user to have access to these programs. Conversely, if you remove or rename these files, the serial number information is ?lost?; you will be prompted to enter the serial number the next time you launch the relevant applications.

Some third-party software, such as the StuffIt applications, also install .plist files in this folder.

Of special significance is a folder within the Preferences folder called SystemConfiguration. Inside SystemConfiguration are a half dozen or so .plist files. They mainly contain settings for network management and energy saver settings. For examples:

  • preferences.plist stores network settings such as the different Locations listed in the Network System Preferences pane.

  • com.apple.airport.preferences.plist contains information such as the list of "Preferred networks," as seen in the AirPort section of the Network System Preferences pane.

  • com.apple.PowerManagement.plist contains many of the parameters set in the Energy Saver System Preferences pane, such as the minutes until display sleep and system sleep.

In most cases, there is no need to directly edit the content of these files, as the values are more easily modified by making changes to the relevant System Preferences pane. If you do anything with these files, it will more likely be to delete them (so that they are replaced with new default copies). This is an often recommended way of resolving various networking-related and power-management-related symptoms. For example, recent MacFixIt items suggested deleting one or more of these files to solve sleep problems and airport connectivity problems.

Back at the root level of the /Library/Preferences folder, the one file that you will most likely have reason to edit is com.apple.AppleFileServer.plist. This file contains settings that determine what happens when others attempt to connect to your Mac via file sharing. As examples:

  • Disable guest access. This was already covered earlier in this tutorial series.

  • Turn on file sharing log. To do this, simply change the value of the activityLog property from No to Yes (you can make this change via Terminal, following the same procedure as previously covered for disabling guest access). This will result in the appearance of a log file named AppleFileServiceAccess.log in /Library/Logs/AppleFileService directory. Checking this log, via the Console application, allows you to see who's currently connected to your computer via File Sharing. Mac OS X does not otherwise provide a user interface for doing this.

    For the record: You can also enable this option via the SharePoints utility (in its AFS Properties pane) and you can also check on whose logged into your Mac via the AFS Monitor utility. But if you want to avoid dependence on shareware/freeware, you now know how to do it.

Q. What about .plist files that are not in any Preferences folder?especially ones that I might want to edit?

A. As you wish. Here are two examples worth noting:

The LaunchDaemons and LaunchAgents folders. Apple keeps changing the method by which you can launch processes as part of the startup sequence. Initially, it was startup items, later it was bootstrap daemons, and most recently it is launchd files. Several launchd configuration files are installed as part of Mac OS X and are found in the /System/Library/LaunchDaemons folder. These files each represent a function that gets carried out at startup or at some other time specified in the file. Each of these files is a .plist file that can be opened, viewed and edited via Property List Editor.

The key property to examine in each file is ProgramArguments. Its value lists the main action initiated by the file. In most cases, the action is to execute a process, often a Unix command. For examples:

  • com.apple.periodic-daily.plist causes the periodic -daily Unix command (/usr/sbin/periodic -daily) to run at the time value specified in StartCalendarInterval property (e.g., 3:15 am). The periodic program performs various maintenance tasks, such as clearing out old log files and updating Unix's locate database.

  • ssh.plist opens the ssh daemon (/usr/sbin/sshd), allowing for remote logins, as turned on by enabling Remote Login in the Sharing System Preferences pane.

To learn more about what these or any other Unix commands actually do, launch Terminal and type man {name of command}.

In addition, launchd files may be located in a LaunchDaemons folder (or a similar in function LaunchAgents folder) in the /Library folder. These folders can contain launchd configuration files installed by third-party software and/or any launchd files that you create yourself. That's right, you can roll your own launchd files!

While you can create these files with Property List Editor, you will have a much easier time using a utility called Lingon, specifically designed for this purpose. For details on how and why to create and execute your own launchd files, check out this mac geekery article or this Macworld article. Or simply type man launchd.plist in Terminal.

While it is relatively safe to work with the launchd files in the /Library folder, I strongly recommend against messing with the launchd files in the /System/Library folder?unless you are confident of what you are doing and willing to take the consequences of something going wrong.

The /etc/ folder. There is one ".plist" file of special interest in this Unix folder. It is called authorization. While the file's name does not include a .plist extension, the file follows the .plist format and opens just fine in Property List Editor. To locate the file in the Finder, type Command-Shift-G; in the "Go to Folder" sheet that drops down, type: /etc.

In brief, this file contains the rules that determine whether or not you are authorized to perform a given action, such as whether or not you can move or modify a file or can change a System Preferences setting. If appropriate, the file's settings will trigger the appearance of an Authenticate dialog box; the needed permission is then typically granted if you enter an admin name and password.

Further details are covered in several Apple developer documents, such as this Technical Note, as well as in my own Mac OS X Help Line. Here is one example of how and why to edit this file:

  1. Use the Pseudo utility to open Property List Editor as the root user and then open the Authorization file.

  2. Double-click the disclosure triangle for "root" and then again for "rights" and then for com.apple.desktopservices. From this location, change the "class" property value from "user" to "allow". Save the change.

Now, during actions where you would normally get an Authenticate dialog in the Finder before being allowed to proceed, you will be able to perform the actions unhindered by such messages.

As a second example, you could similarly change the value of the "timeout" property in com.apple.desktopservices from 0 to something else, say 300. After doing this, you will still get an Authenticate dialog in the Finder when appropriate. However, after entering your name and password, the dialog will not reappear again for the next 5 minutes (300 seconds). You will automatically have permission for actions that would otherwise trigger the Authenticate dialog during this interval. This could be convenient if you are doing a series of actions that would otherwise repeatedly bring up the dialog.

The usual warnings apply here: Making these changes significantly reduces the security of your Mac. Don't do this if you are in an environment where you are concerned about others having access to your Mac and what they might do. Second, this is a critical file to the operation of your Mac. Making errors to the content of this file could result in serious problems. Always have a backup of the file and don't even think of fiddling around here unless you are confident of your troubleshooting skills.

Q. Are there still other locations where .plist files are found?

A. Yup. For these locations, you will rarely (if ever) need to edit the .plist files, but it can still be informative to know what they do. Here are two examples:

info.plist files in applications and .pkg files. Almost all Mac OS X applications are actually packages, a special type of folder that appears as a single file in the Finder. To look inside such packages, use the Show Package Contents contextual menu command.

As an example, do this for the TextEdit application. Once inside the package, a window containing a Contents folder appears. Inside the Contents folder are a number of files and folders, including one called info.plist. Open this file in Property List Editor to view its contents. If you examine the properties and values of this file, you will find numerous interesting nuggets. For example:

  • CFBundleDocumentTypes. If you bore your way down into this array, you will eventually have a list of every type of document (most often identified by its extension, such as "rtf") that the application can successfully open.

  • CFBundlePackage and CFBundleSignature. The values of these two properties are the old "type" and "creator" codes of the application. For TextEdit, they are APPL (meaning an application) and ttxt (the creator code for TextEdit). Note: this same information is contained in the PkgInfo file, also located in the Contents folder.

Info.plist files are also found inside the .pkg files that are the "documents" of the Installer utility (such as MacOSXUpdCombo10.4.7PPC.pkg). However, the properties contained in these info.plist files are different from those in application info.plist files. For example, you will likely find:

  • IFPackageFlagAuthorizationAction. The value here indicates whether or not a password is needed to install the software.

  • IFPackageFlagRestartAction. The value here determines whether or not you are required to restart your Mac after the installation is over.

/System/Library/CoreServices/. Inside this folder is a file called SystemVersion.plist. It contains the system version and build number of the installed version of Mac OS X, as seen in the About This Mac window.

Q. Are there invisible .plist files?

A. Yes. A few .plist files are invisible in the Finder, due to the period (.) at the start of their name. The easiest way to see these files is to make all invisible files visible, via a utility such as Show Hide Invisible Files.

The main example here is .GlobalPreferences.plist. There are actually several versions of this file. There is one such file, for example, in ~/Library/Preferences and another in /Library/Preferences. The one in your Home directory contains settings that apply generally to your account regardless of the specific application (such as your highlight color). The one in the main Library folder contains settings that apply to all accounts (such as some Energy Saver settings not specified in the aforementioned com.apple.PowerManagement.plist file). More generally, if an application's own .plist file does not define a value for a given property, and that value is defined in a relevant .GlobalPreferences.plist file, the value in the .GlobalPreferences.plist file will be used for the application.

That's it for this time. There is one last installment planned for this series: a list of my favorite .plist file modifications (beyond the ones already covered in this and previous installments).

Ted Landau is the author of Mac OS X Help Line: Tiger Edition, now also available as a PDF download, where you can learn all the dirt on .plist files and everything else related to troubleshooting Mac OS X.

Like what you've found in this tutorial? Get more troubleshooting guidance (updated daily) by subscribing to MacFixIt Pro.

Resources
  • Parts I & II
  • Part III
  • Part IV
  • Part V
  • Part I
  • sleep problems
  • airport connectivity probl...
  • already covered
  • SharePoints
  • AFS Monitor
  • Lingon
  • mac geekery article
  • Macworld article
  • Technical Note
  • Show Hide Invisible Files
  • Mac OS X Help Line: Tiger ...
  • PDF download
  • subscribing to MacFixIt Pr...
  • More from Tutorials
  •  

    Join the discussion

    Conversation powered by Livefyre

    Show Comments Hide Comments
    Latest Galleries from CNET
    Best mobile games of 2014
    Nissan gives new Murano bold style (pictures)
    Top great space moments in 2014 (pictures)
    This is it: The Audiophiliac's top in-ear headphones of 2014 (pictures)
    ZTE's wallet-friendly Grand X (pictures)
    Lenovo reprises clever design for the Yoga Tablet 2 (Pictures)