Libraries in OS X

There are three main libraries in OS X that may sometimes be a source of confusion for users, especially when troubleshooting odd problems that may happen with the system.

As its name suggests, a library in OS X is a central location for a number of shared resources that the system and applications use, which can include alert sounds, desktop pictures, fonts, Internet plug-ins, and other similar items. Sometimes, as in the case with fonts, these are accessed by multiple applications, but other times individual applications may set up their own resource folders in the library. In addition to static resources, libraries are also used to store temporary items such as caches, preferences, and cookies.

There are four main libraries in OS X that serve similar but different purposes, and if you have a font or other item you would like to install, placing them in these different libraries may have different effects on the system.

The user and global libraries in OS X will have the same icon, but the System library may appear like a regular folder. The icons used will be different for different versions of OS X.

System library: /Macintosh HD/System/Library/
The first library in OS X is in the System folder, and it contains core system-related items like the Finder and Dock applications. This is the top-level Finder-accessible library in the system, and it contains most items the system needs to run smoothly, so it should practically never be touched. Technically you can add items like fonts, sounds, and screensavers to this library, but doing this is not recommended and may result in some applications not being able to find items. If you need to add items to a library on the system, even though there may be a folder to contain the specific item in the System library (e.g., Fonts and Sounds), you likely should be adding it to one of the other two.

Global library: /Macintosh HD/Library/
The second library is the global user library, which contains items that are available to all applications and all users. If you install a font or desktop picture in this folder, then all user accounts on the system will be able to access it. For most applications being installed to the main /Macintosh HD/Applications/ folder, if they require the installation of shared resources then they will place them in this global library for all users.

User library: /Macintosh HD/Users/username/Library/
The last user-accessible library in your system is the user library, which is located in the Home folder of your user account. When you log in to your account, the items in this library are in effect consolidated with the items in the main library, so for instance, any personal fonts or sounds you have installed in this library will be available to applications alongside those installed in the global library.

The user library is also where the system and applications store your personal settings and customizations. Sometimes applications may have the option to install user-specific resources, in which case they will be placed into this library instead of the global library.

If you want to add an item to a library in OS X, we recommend you start with this user library, especially if you have other active accounts on the system that other people access. Doing so will help prevent clutter of items in their accounts, and also potentially prevent conflicts if they have their own unique account settings for similar items that you are adding.

Hidden library: /usr/lib/
Besides user-accessible libraries, this last library is hidden from view. As with any hidden folder in OS X, this library should not be tampered with unless you know exactly what you are doing. The library contains a number of low-level interfaces and library files that applications may use when running. These can provide a number of features such as multithreading support, networking, or printing. When applications are compiled they may be built using this library's files as dependencies, and therefore will require the contents to remain intact in order to run.

The only ways to manually access this hidden library are through the Terminal and by using the Finder's "Go" menu, unless you otherwise enable viewing of hidden files in the Finder or use a third-party filesystem browser. In addition to this resource as a specific library, there are other hidden resources that similarly act as libraries and configuration locations for the system and services the system provides. Unless you know what you are doing, or have specific instructions on altering these hidden resources, it is best to leave them alone.

Potential problems and troubleshooting
This library organization in OS X is convenient, especially for a system that contains multiple accounts; however, there may be times when items in one library can conflict with items in another library. Sometimes there may be duplicate instances of the same item in different libraries, or a corruption in one library may cause problems with one or multiple users' experiences. Troubleshooting these problems can sometimes be a daunting task, and many times there are specific steps to take for problems with individual applications; however, overall there are some general steps you can take to at least isolate a problem to issues with items in a specific library:

  1. New User account

    After unlocking the Accounts preference pane, click the plus sign to add a new user account, or optionally you can use the Guest account. Once you are done troubleshooting, you can use this pane to remove or disable the added accounts.

    In troubleshooting a problem, the easiest way to determine if the problem is in a user library or in a more global resource is to create a new temporary user account. In the "Accounts" system preferences you can add a user to the system and then log in under that name. The library for that user will be set up from a default template, so all items in it should be fresh and healthy. If the problem persists then you know to look elsewhere on the system for the problem, such as in the global library, the Applications folder, or in the system library if there are problems with system services and features.

  2. Safe Mode

    The "Safe Mode" boot option in OS X (holding Shift at start-up) will turn off many unnecessary extensions and prevent automatic log-in and the launch of log-in items. Since many of the disabled extensions are in the global and system libraries, this minimal boot environment can help determine if a problem is in one of these libraries; this is especially true when used in conjunction with a new User Account.

  3. Utilities

    A number of utilities are available that can help manage items in the user and global libraries. Apple's Font Book is useful for enabling and disabling font sets, verifying fonts, and otherwise diagnosing issues with Fonts. Using Safe Mode itself will also remove and rebuild some boot and system caches in which corruption could cause system problems. Lastly, Apple's Disk Utility program can be used to verify and repair permissions in the global and system libraries, which is another potential cause for problems.

    In addition to these options, a number of third-party maintenance utilities can be used to clear temporary items in the system's libraries. Most will have a standard set of options for clearing user and application caches, font caches, the launch services, and other routine services in OS X, but others may have more specialized approaches, and allow for a more detailed cleaning. Despite this, most should work fine for clearing and rebuilding caches in the system.

  4. The Finder

    Since the specific location of resources in the library is a requirement for them to load properly, you can troubleshoot items in the library by temporarily removing them from their default locations using a filesystem browser (the Finder). One example of this is when managing Internet Plug-Ins. If your Web browsers are all crashing, you can go to the /Macintosh HD/Library/Internet Plug-Ins/ folder and manually remove the plug-ins to disable them. Then launch your browsers to see if they continue to crash. If not, then you can move plug-ins back to the Internet Plug-Ins folder one by one and relaunching the browsers to see which one is causing the problems.



Questions? Comments? Have a fix? Post them below or e-mail us!
Be sure to check us out on Twitter and the CNET Mac forums.

Tags:
Computers
About the author

    Topher, an avid Mac user for the past 15 years, has been a contributing author to MacFixIt since the spring of 2008. One of his passions is troubleshooting Mac problems and making the best use of Macs and Apple hardware at home and in the workplace.

     

    Join the discussion

    Conversation powered by Livefyre

    Show Comments Hide Comments