Mac PATH: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(5 intermediate revisions by the same user not shown)
Line 7: Line 7:
=Overview=
=Overview=
On Macs, the value of the <code>[[Bash_Built-In_Variables#PATH|PATH]]</code> variable is built by the <code>path_helper</code> utility from the content of the <code>/etc/paths</code> file and the <code>/etc/paths.d</code> directory.
On Macs, the value of the <code>[[Bash_Built-In_Variables#PATH|PATH]]</code> variable is built by the <code>path_helper</code> utility from the content of the <code>/etc/paths</code> file and the <code>/etc/paths.d</code> directory.
=<tt>/etc/paths</tt>=
The file contains the paths that need to be set in the <code>PATH</code> 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.
=<tt>/etc/paths.d</tt>=
This directory contains the list of files. Each of the files contains the path that needs to be added to the end of <code>PATH</code> 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 <code>10-something</code> file will show up before the value specified in <code>20-soemethingelse</code>. The paths specified here work for all users. The primary reason that <code>/etc/paths.d</code> directory is used because <code>/etc/paths</code> will be modified and/or replaced by system upgrades while contents of <code>/etc/paths.d</code> directory will never be affected by such changes.

Latest revision as of 03:18, 6 January 2022

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.