Missing /usr/local/sbin directory in the /etc/paths file
Why doesn’t the /etc/paths
file include the /usr/local/sbin
directory on macOS?
$ cat /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
I would have expected:
$ cat /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/local/sbin
/usr/sbin
/sbin
Note. — The /etc/paths
file is read by the /etc/profile
shell script to generate the PATH
environment variable.
The /usr/local/sbin
directory does not exist on a default macOS installation, but you can easily add it yourself.
To add that directory to the system-wide PATH
environment variable (for all users), as there is always the risk of a macOS update overwriting /etc/paths
, it might be better to add a file named usr_local_sbin
(or anything else) to /etc/paths.d
with that single line:
/usr/local/sbin
This will put the /usr/local/sbin
path in a position close to the end of PATH
, which usually (assuming unique command names) is not a problem. If you want to have it early in PATH
for whatever reason, either add to /etc/paths
nevertheless or edit the PATH
order in the user-specific ~/.profile
.