MAC OS Bash Path Location
In macOS, the system-wide PATH variable is defined by the contents of the /etc/paths file and the files within the /etc/path.d/ directory. These files determine the order and locations where the system looks for executable files when you run a command in the Terminal.
Here’s a breakdown of each of these components:
-
/etc/paths:-
This file contains a list of directories, one per line. These directories are automatically included in the system-wide PATH variable.
-
When you open a Terminal window, the shell reads the
/etc/pathsfile and adds the directories listed in it to the beginning of your PATH variable. -
You can view the contents of this file by using a text editor or by running the following command in the Terminal:
1cat /etc/paths
-
-
/etc/path.d/:-
The
/etc/path.d/directory contains additional files that contribute to the PATH variable. -
Each file in this directory represents a directory to be added to the PATH, and the files are processed in alphabetical order.
-
The directories listed in these files are appended to the end of the PATH variable.
-
You can see the contents of the
/etc/path.d/directory by running:1ls /etc/path.d/
-