By 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 like directories .

This article will start by explaining what is the user , local , system and network domain . After that it will explicate the standard directories that belongs to these domains. Next it will explain what are the Unix/posix like standard 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 domain ? 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 domain ?

In a 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 , 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 resources 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 the apple store , or by dragging and dropping an application into the application folder . Applications under the /Applications folder will appear under the launchpad . For example there are 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 . For example there are the App Store , Automator …

@MacBook-Air:/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     

# ### ls /System/Applications ###

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-Air:/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
...
...
. 
# ### ls /Users/username/Library ###

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-Air:/Library$ ls
# Library folder in the local domain
# /Library 
ColorPickers          Java                  Ruby
Components            Keychains             Fonts                  
Frameworks            Preferences           Python
...
....
.
. 
# ### ls /Library ###

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-Air:/System$ ls Library/
# Library folder under the system domain
# /System/Library
AWD                     Filesystems             PreferencePanes
Accessibility           Filters                 Preferences    
..
.

The Library folder contains some subfolder , that can be used by all the installed application . 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-Air:/Library/Application Support/App Store$ ls
# App Store files in the local domain,
# Library Application Support folder .
adoption.plist
# ### Application Support local domain ###

@MacBook-Air:/Users/username/Library/Application Support/App Store$ ls
# App Store files in the user domain ,
# Library Application Support folder .
StoreKit.db         updatejournal.plist
# ### Application Support user domain ###

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 folder
# Caches under user domain
# /Users/username/Library/Caches/
CommerceRequestCache  

# ### ls ~/Library/Caches/com.apple.iTunes###

2.2.3- Frameworks

A framework , is the frame under which an application can work . As such the Frameworks directory contains the libraries that 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 domain . 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
# ### ls /Library/Preferences ###

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

# ### ls /System/Library/Preferences ###

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 belongs 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
		
# ### tree -L 1 /System ###

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 like 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 contain 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
# ### ls /bin ###

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

@MacBook:/dev$ ls
# special files -- device file 
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   
# ### ls /dev ###

/etc : This folder contains configurations files for Unix like applications , for example passwd , groups …

@MacBook:/etc$ ls
# configuration files for unix / posix like 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
...
..
# ### ls /etc ###

/sbin : contains Unix like 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
...
..
# ### ls /sbin ###

/tmp : contains temporary files and folders created by the 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
..
.
# ### ls /usr ###

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

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

/opt : contains optional commands , binaries , libraries and ressources which are not part of the 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 when an application has crashed .

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