Understanding Your Mac’s System Folders | Tips & Tricks
System folders are folders not intended to be accessed by the user. They help applications and the operating system run, providing support and resources. They’re the layer that allows users to manipulate the host through applications and programs. Some are hidden, and some are not, but almost all are accessible to the user in some way.
But what are the different system folders for? What’s “bin,” and how does it help your computer? We will examine the most commonly-referenced system folders below.
The “/System” folder itself on your Mac doesn’t contain much. We will first look at its contents before moving on to other, deeper system folders.
Note: Do not add to, remove, or modify system folders and files. You can browse safely, but adding, removing, or modifying files or changing the folders themselves can have unpredictable – and sometimes system-breaking – consequences. If you must experiment, make a bootable clone of your Mac before proceeding.
Library Folders: /System/Library and ~/Library
Library folders are closest to the user. They are created by applications, and applications add, remove, and modify files over the course of their operation. To be frank, the organizational process here can be a little chaotic. Applications are basically free to do what they like when it comes to placing files in the Library, but most follow a fairly similar process.
You’ll find a huge variety of files and folders in both the user Library folder (found at “~/Library”) and the system Library folder (found at “/System/Library”). These files save preferences, application databases, metadata, plugins, saved application states, system profiles, cookies, and much, much more.
The “~/Library/Application Support” folder is the most frequently accessed Library folder. Here, applications save files needed for their operations. Away from the user’s data folders, these files can be segregated to avoid contamination or modification.
When users access this folder, it’s to change the way a program works in a way that is unsupported by the default settings or to fix some kind of cache or database error. Removing a program’s Application Support folder is a good way to reset the program to its default state and force a clean start. And if you want to hack around in an application, you’ll find yourself in that program’s Application Support folder before too long.
What’s the difference between /System/Library and ~/Library?
Why does macOS need two Library folders? The System library is used by all users for system-wide needs. It’s accessible to all users. The user Library, on the other hand, is accessible only by that particular user.
Unix Folders: /bin, /sbin, /usr, /var, /private
macOS is built on top of a Unix kernel. This means that much of its deep functionality is based on Unix functionality. So apart from the higher-level macOS system folders, you’ll find Unix folders as well. These folders are universally hidden, so you’ll need to reveal hidden files to follow the tour.
You’ll find quite a few Unix folders in your home directory. The most notable are “/bin” and “/sbin,” “/usr,” “/var,” and “/private.”
“/bin” and “/sbin” both hold binaries. “sbin” holds binaries needed for booting, restoring, recovering, and repairing the system even without a file system mounted. “/bin” holds essentially user commands for use by all users. “bin” stands for binaries and “sbin” stands for system binaries.
On macOS most of the filesystem-mounting binaries in “/sbin” are symlinked to macOS file system plugins in the “/System/Library/Filesystems” folder.
“/usr” contains binaries and libraries used during normal system operation. Files here are used after a file system is mounted. “usr” is short for “user” or Unix System Resources.
“/var” contains files the system writes to over the course of its operation, like caches, data libraries, and logs. Var stands for variable and is typically only written to by core-level system applications. On macOS “/var” is symlinked to “/private/var.”
“/private” contains daemon and command line tool configurations, caches, variables, virtual memory swap files, temporary files, and sleep images. Some Unix system folders like “/etc” and “/tmp” are symlinked to an identically-named directory in /private for their contents.
If you want to learn about the contents of these folders, you can check out this detailed breakdown of the Mac’s Unix folders.
If you’ve ever built a Hackintosh, you’ve heard of “System/Library/Extensions.” Commonly abbreviated “S/L/E,” this folder contains “kexts,” or kernel extensions, that expand the functionality of the macOS kernel. Adding kexts helps the macOS kernel communicate with new hardware. If you’re from Windows-land, kexts are like drivers.
Modifying the contents of this folder is tricky business, requiring careful permissions management. If you want to add or remove kexts on macOS, make sure you do it right.
Agents and Daemons
Daemons and agents run in the background, performing tasks without interaction from the user. The unusual name (pronounced as “demon”) originates with Maxwell’s daemon.
Daemons perform system operations and are run by root, while agents are run by the currently logged-in user. Global agents and daemons can be accessed and run on behalf of any user, while user agents can only be run on behalf of the user that owns their library file.
- “~/Library/LaunchAgents” contains user agents run on behalf of the logged in user
- “/Library/LaunchAgents” contains global agents run on behalf of the logged in user
- “/System/Library/LaunchAgents” contains system agents run on behalf of the logged in user
- “/Library/LaunchDaemons” contains global daemons run by root
- “/System/Library/LaunchDaemons” contains system daemons run by root
You can create new daemons and configure existing ones with the command line program launchctl.
There are other non-user folders hidden away on your Mac, but those above are the most commonly accessed. You can learn more about how Unix file systems are organized by checking out the Filesystem Hierarchy Standard, which explains the requirements and guidelines for Unix-like file and directory placement.