Risks of Adding /usr/libexec to $PATH

command linepathSecurity

I want easy access to PlistBuddy, which I wasn't even sure still shipped with macOS (Big Sur 11.3 here).

I found it in /usr/libexec, a directory I don't know well, but which contains a large number of executables, some of which I already use. So why isn't /usr/libexec in the default $PATH?

I prefer a big $PATH, and if it's safe, and I would edit my ~/.${SHELL##*/}rc with something like this:

export PATH=/usr/libexec:${PATH}

instead of adding this:

alias PlistBuddy=/usr/libexec/PlistBuddy

Is there any reason not to?

Best Answer

You should not add /usr/libexec to your path.

/usr/libexec is intended for "system daemons & system utilities (executed by other programs)". This is the description from the command man hier.

So you don't want to directly run something from there by mistake.

If you have a reason to run one of those executables directly it is better create an alias.