By Mohamad Wael

Last updated :

Posted :

MacOs Directory Structure

In macOS, there are some standard directories, which can be in one of the user, local, system, or network domains. There are also some standard unix/posix directories.

This article will start by explaining what is the user, local, system, and network domain. After that, it will explain the standard directories, that belongs to these domains. Next it will explain the unix/posix directories. Finally it will elucidate, the other macos directories.

what is the user , local , system network domains ? what are the standard folders ? what are the posix / unix like folders ?
Table of contents What are the user, local, system, and network domains? Standard folders Applications Library Application Support Caches Frameworks Preferences Network System Users Posix or Unix directories Other directories

1- What are the user, local, system, and network domains?

In macOs, there are some standard folders, these standard folders can be in one or multiple domains. The domains that a folder can be in are the:

The user domain, is the user directory, it contains files and applications and resources, which are related to a given user. This folder is located under the /Users/username, and it contains multiple folders, such as the Applications folder, the Library folder, the Movies folder. A user can make changes to his files. The user directory can also be placed on the network.

The local domain is the domain which is related to the current computer, as such it contains applications, files, and resources, related to to the current computer, and shared among the users. The local domain contains multiple folders, and an administrator, can make changes to these folders and files.

# examples of folders in
# the local domain.
/Applications
/Library
..

The system domain, contains resource files, and applications, which are related to the system , and which are installed by apple. The /System directory, placed under the root directory /, is part of the system domain.

The network domain, are the applications, files and resources, which are located on a network, and shared by the users of a network.

2- Standard folders

2.1- Applications

There are multiple Applications folders, and they can be located under multiple domains.

The Applications folder that belongs to the local domain, is placed under the root directory /Applications. It contains the applications that will be used by all the users. These applications can be installed by using apple store, or by dragging and dropping an application into the application folder. Applications under the /Applications folder, will appear under the launchpad. An example of an application in the local domain is: pages

The Applications folder, that belong to the user domain, is placed under /Users/username/Applications, and it contains applications related to the user .

The Applications folder, that belong to the system domain, is placed under /System/Applications, and it contains applications installed by Apple. Applications under the /System/Applications folder, will appear under the launchpad. Examples of such applications, are the App Store, or Automator…

macBook:/System/Applications$ ls
# Applications under the /System/Applications folder
App Store.app          Image Capture.app      Preview.app
Automator.app          Launchpad.app          QuickTime Player.app
Books.app              Mail.app               Reminders.app
Calculator.app         Maps.app               Siri.app
Calendar.app           Messages.app           Stickies.app
Chess.app              Mission Control.app    Stocks.app
Contacts.app           Music.app              System Preferences.app
Dictionary.app         News.app               TV.app
FaceTime.app           Notes.app              TextEdit.app
FindMy.app             Photo Booth.app        Time Machine.app
Font Book.app          Photos.app             Utilities
Home.app               Podcasts.app           VoiceMemos.app

2.2- Library

A library is a collection of information, which is kept to be used. In macOs there are multiple library folders, and each of them belong to a different domain. A Library folder can contain cache files, resources, configurations, preferences… related to an application.

In the user domain, the Library folder is used to store informations, about the applications related to the current user. It is located under the user directory: /Users/username/Library .

macBook:/Users/username/Library$ ls
# Library folder in the user domain
# /Users/username/Library
Accounts                Keychains
Application Scripts     LaunchAgents
Application Support     Logs
ColorPickers            PersonalizationPortrait
Colors                  Personas
Containers              PreferencePanes
Fonts                   Sounds
FrontBoard              Spelling
...
...
.

In the local domain, the Library folder is located under the root directory /Library, and it contains informations related to an application(s), and shared by all the users of this application(s).

macBook:/Library$ ls
# Library folder in the local domain
# /Library
ColorPickers          Java                  Ruby
Components            Keychains             Fonts
Frameworks            Preferences           Python
...
....
.

In the system domain, the Library folder is located under /System/Library. This folder is used by macOS, and it will contains files and resources, related to system applications.

macBook:/System$ ls Library/
# Library folder under the system domain
# /System/Library
AWD                     Filesystems             PreferencePanes
Accessibility           Filters                 Preferences
..
.

The Library folder, contains some subfolders, that can be used by all the installed applications, and they are:

2.2.1- Application Support

The Application Support folder, contains files to support the application. Applications can place inside this folder, their data and configuration files, in multiple domains.

If the Application Support folder, is located under the local domain /Library/Application Support, it will contain files related to all the users. If it is within the user domain /Users/username/Library/Application Support, it will only contain files related to the current user. For example, the App Store application, contains support files in the local domain , and in the user domain .

macBook:/Library/Application Support/App Store$ ls
# /Library/Application Support/App Store
# files in the local domain,
adoption.plist

macBook:/Users/username/Library/Application Support/App Store$ ls
# /Users/username/Library/Application Support/App Store
# files in the user domain.
StoreKit.db         updatejournal.plist

2.2.2- Caches

Used for caching by an application. An application can recreate the content which is stored inside this folder, and this folder can belong to multiple domains. For example, an application can use the Caches folder, to download its update files.

macBook:~/Library/Caches/com.apple.iTunes$ ls
# ~ stands for the user home directory
# # /Users/username/Library/Caches/com.apple.iTunes
# files under user domain.
CommerceRequestCache

2.2.3- Frameworks

A framework, is the frame under which an application can work. As such the Frameworks directory, contains the libraries that are used, or needed, to create an application. The Frameworks directory, can belong to multiple domain. Under the system domain, the Frameworks directory contains the frameworks, needed to create an application.

macBook:/System/Library/Frameworks$ ls
# Frameworks folder under the system
# domain

AVFoundation.framework            ImageIO.framework
AVKit.framework                   InputMethodKit.framework
Cocoa.framework                   MetalKit.framework
ColorSync.framework               ModelIO.framework
Contacts.framework                MultipeerConnectivity.framework
ContactsUI.framework              NaturalLanguage.framework
CoreAudio.framework               NetFS.framework
CoreAudioKit.framework            Network.framework
CoreML.framework                  PhotosUI.framework
...

Under the local domain , the Frameworks directory, contains frameworks needed to interact with a local application.

macBook:/Library/Frameworks$ ls
# Frameworks folder under the local
# domain
iTunesLibrary.framework
...
..

2.2.4- Preferences

The Preferences folder contains the application preferences, it can belong to multiple domains. If it is in the local domain, it is the preferences of the application for all users. If it is in the user domain, it is the user preferences for a given application. If it is in the system domain, it contains preferences for applications in the system domain.

macBook:/Library/Preferences$ ls
# Preferences folder in the local
# domain
com.apple.PowerManagement.plist
com.apple.SoftwareUpdate.plist
com.apple.TimeMachine.plist
com.apple.commerce.plist
com.apple.dock.plist
com.apple.driver.AppleIRController.plist
com.apple.dt.Xcode.plist
com.apple.security.plist


macBook:/System/Library/Preferences$ ls
# Preferences folder in the system
# domain
Calendar              Logging               ProtectedCloudStorage

2.3- Network

The /Network folder, contains files and resources, which belong to the network domain. As such it can contain a list of computers, that are on the local network, and which files and ressources can be accessed.

2.4- System

The /System folder, contains files and resources, which belong to the system domain, these files are installed by apple, and they shouldn't be modified.

macBook:/System$ tree -L 1
# List only the top level 
# directories in the /System 
# folder
.
|-- Applications
|-- DriverKit
|-- Library
|-- Volumes
|-- iOSSupport

2.5- Users

The /Users folder, belongs to the user domain, as such it contains user related applications, files and resources. Each user has its own user folder, which is located under /Users/username, and the user user folder, is formed of many standard subfolders, which are:

3- Posix or Unix directories

MacOs also has some unix directories, these directories are:

/bin: This directory contains unix like user commands or utilities, such as ls, which is used to get the list of files and directories.

macBook:/bin$ ls
# The /bin directory contains user commands
[         date      hostname  ls        rm        tcsh
bash      dd        kill      mkdir     rmdir     test
cat       df        ksh       mv        sh        unlink
chmod     echo      launchctl pax       sleep     wait4path
cp        ed        link      ps        stty      zsh
csh       expr      ln        pwd       sync

/dev: contains some unix like device files, which allow a user, to interact with a device, like he is interacting with a file.

macBook:/dev$ ls
# device files, also known
# as special files.
HAX                        disk1                      rdisk0
afsc_type5                 disk1s1                    rdisk0s1
auditpipe                  disk1s2                    rdisk0s2
auditsessions              disk1s3                    rdisk1
autofs                     disk1s4                    rdisk1s1
autofs_control             dtrace                     rdisk1s2
autofs_homedirmounter      dtracehelper               rdisk1s3
autofs_notrigger           fbt                        rdisk1s4
autofs_nowait              fsevents                   sdt
bpf0                       io8log                     stderr
bpf1                       io8logmt                   stdin
bpf2                       io8logtemp                 stdout
bpf3                       klog                       systrace
bpf4                       lockstat                   urandom
console                    machtrace                  vboxdrv
cu.Bluetooth-Incoming-Port null                       vboxdrvu
disk0                      oslog                      vboxnetctl
disk0s1                    oslog_stream               xcpm
disk0s2                    random

/etc: This folder contains configurations files, for unix applications, for example passwd or groups…

macBook:/etc$ ls
# configuration files for unix/posix application

apache2                               ntp.conf
auto_home                             passwd
auto_master                           paths
autofs.conf                           paths.d
bashrc                                periodic
csh.cshrc                             php-fpm.conf.default
csh.login                             php-fpm.d
csh.logout                            php.ini.default
hosts                                 rpc
mach_init.d                           ssl
mach_init_per_login_session.d         sudo_lecture
mach_init_per_user.d                  sudoers
mail.rc                               sudoers.d
man.conf                              syslog.conf
manpaths                              ttys
manpaths.d                            vpns1.2.4.1
...
..

/sbin: contains unix utilities and commands, used by system administrators, like for example commands used for networking, or for the filesystem.

macBook:/sbin$ ls
# The /sbin folder contains
# system commands and utilities

autodiskmount    disklabel        dmesg            halt
nologin          mount_hfs        ping             fsck
ping6            md5              reboot           route
shutdown         umount
...
..

/tmp: contains temporary files and folders, created by applications and the system, these temporary files can be deleted .

/usr: this directory contains commands, utilities, libraries and shared resources, which are not essential for the system.

macBook:/usr$ ls
# The /usr directory content
bin        libexec    sbin       standalone
lib        local      share
..
.

/var: contains data, which content and size might change, such as log files.

@MacBook:/var$ ls
# The /var directory content
mail     log      msgs
...
..

/opt: contains optional commands, binaries, libraries and ressources, which are not part of a unix distribution.

4- Other directories

/Volumes: This is where all the volumes are mounted, for example the hard drive is found in here.

macBook:/Volumes$ tree -dlL 2
# print directories tree in Volumes
# -d : show only the directories
# l : follow symbolic links
# L 2 : show only level one and
#       level two directories

.
|-- Macintosh\ HD -> /
    |-- Applications
    |-- Library
    |-- Network
    |-- System
    |-- Users
    |-- Volumes
    |-- bin
    |-- cores
    |-- dev
    |-- etc -> private/etc
    |-- home
    |-- net
    |-- opt
    |-- private
    |-- sbin
    |-- tmp -> private/tmp
    |-- usr
    |-- var -> private/var

/cores: contains core dumps, as in when an application has crashed.

/private: this is a folder which contains the etc, tmp and var folders, described earlier. /etc, /tmp and /var, are symbolic links to folders inside this directory.