I often write system-wide scripts and I wonder where to place my executables on macOS.
On many Linux system, /usr/local/bin
(also /usr/local/sbin
) is usually empty and I place my executables in there.
But on macOS, /usr/local/bin
has already contained a lot of executables provided by such as Homebrew.
I understand /usr/local/bin
is the most proper directory to place executables locally installed and similar questions also are answered /usr/local/bin
, but I feel hesitant to contaminate by mixing my executables.
Is it good manner to place my executables in /usr/local/bin
in spite of many other executables existing?
In other way, I am wondering where is the second best directory to place my executables.
I think /opt/bin
is the second best at the moment because /opt/bin
seems to proper directory to place my executables by its purpose and /opt/bin
does not exist by default on macOS (empty assured).
Is there any idea or advice about my wondering?
similar questions (answered /usr/local/bin
is best):
~/.local/bin
as described in the systemd file hierarchy, extending the XDG spec. Doesn't require special permissions, keeps~
clutter free, but is still easy to find.~/.local/bin
too for many years. I agree completely that this is smart way for personal use executables. But I wondered where to place system-wide my executables./usr/local/bin
is what I do for that./usr/local/bin
. I will follow the way you and mattficle suggested.