Mac PATH

From NovaOrdis Knowledge Base
Jump to: navigation, search

External

Internal

Overview

On Macs, the value of the PATH variable is built by the path_helper utility from the content of the /etc/paths file and the /etc/paths.d directory.

/etc/paths

The file contains the paths that need to be set in the PATH environment variable, one per line, in the order in which to show up in the environment variable value. The paths specified here work for all users.

/etc/paths.d

This directory contains the list of files. Each of the files contains the path that needs to be added to the end of PATH variable value. The order in which the values are added is given by the alphanumeric order of the file names. The value specified in a 10-something file will show up before the value specified in 20-soemethingelse. The paths specified here work for all users. The primary reason that /etc/paths.d directory is used because /etc/paths will be modified and/or replaced by system upgrades while contents of /etc/paths.d directory will never be affected by such changes.