Search code examples
homebrew

What are the different directories of an Homebrew installation (/usr/local/...) for


I am trying to get a hold of the structure of my Homebrew setup and would like to know what these different directories in /usr/local are for:

/usr/local/bin
/usr/local/Caskroom
/usr/local/Cellar
/usr/local/etc
/usr/local/Frameworks
/usr/local/Homebrew
/usr/local/include
/usr/local/lib
/usr/local/opt
/usr/local/remotedesktop
/usr/local/sbin
/usr/local/share
/usr/local/var

Homebrew

contains the Homebrew app

Cellar

contains all the racks someone installs through Homebrew. A rack contains the different versions of an application

But the rest: bin, etc, Frameworks, include, lib, ...?


Solution

  • Many of these directories are part of the Filesystem Hierarchy Standard, and so have a standardised purpose regardless of the fact that you're using Homebrew.

    My answer is based mainly from hier(7) for directories that both macOS and Linux share, and the MacPorts wiki for more macOS specific answers.

    🖥 Non-Homebrew Specific

    /usr/local/bin

    This is where your standard executable files are stored. e.g. When you type vim into the terminal, the file that's run is stored here.

    /usr/local/etc

    These are local configuration files. Shell completion files are examples of this (when you hit tab to autofill a command's options).

    /usr/local/include

    This is where header files are stored that are used by C programs. These contain pre-defined functions.

    /usr/local/lib

    Object libraries are stored here.

    /usr/local/opt

    This contains static files, including licenses, READMEs, and install receipts.

    /usr/local/sbin

    These are executable files that which aren't normally run by standard users. e.g. System programs and administration utilities.

    /usr/local/share

    This folder contains architecture-independent files. Examples might include documentation and man pages.

    /usr/local/var

    Files which may change in size can be stored here. Log files are a good example.

    🍎 macOS Specific

    /usr/local/Frameworks

    This is for native macOS frameworks. Python makes use of this for storing the Python app and executable.

    /usr/local/remotedesktop

    I'm guessing that this stores files from Apple Remote Desktop.

    🍺 Homebrew Specific

    /usr/local/Caskroom

    This directory contains named casks (i.e. applications) e.g. Firefox, Telegram. See the Homebrew terminology page for more information.