Where to Install Command-Line App Folder in macOS

command linefoldersunix


Goal: Easily download zip file with a console app (and other files), execute it, and later replace it with updated version.


When I want to download a console app, with a command-line interface, into what appropriate folder should I place it? I want the tool to be automatically present on the PATH.

I am not referring to the Apple developer tools from Xcode. I am asking about third-party tools such as Microsoft Kiota.

From what little I know about other Unix-oriented operating systems such as FreeBSD, /opt is the usual place for added third-party apps not controlled by the OS. I added a /opt to my macOS Sonoma 14.4.1 machine. I can explicitly run the console app from there. But that location does not seem to be on the PATH automatically.

I tried /usr/local and /usr/local/bin. But no go. Executing kiota --version results in "kiota not found".

screenshot in Finder.app of /usr/local

I found /usr/local/bin existing on my Mac. Several exiting items are found there, all related to Docker (presumably from my install of Docker Desktop app). All of those items are reported by the Finder.app as being "Alias", though I suspect they are actually symlinks. Using "Show original" in the Finder for those Docker items takes me to a folder nested within the GUI Mac app Docker.app. Placing my Kiota folder hierarchy within usr/local/bin does not result in putting kiota on the default PATH in Terminal.app, even after a system restart.


One workaround is to give up on the convenience of PATH. Drag and drop the kiota from any folder into the Terminal.app window. The tool then executes successfully:

/usr/local/Kiota/osx-arm64/kiota --version


(1.14.0 is indeed expected, and correct.)

Another workaround is to manually add to the values within the PATH environment variable. But… the entire point of my Question is to avoid manipulating the PATH explicitly. As far as I know, all other Unix-oriented OSes such as BSD & Linux offer a default place for third-party console apps. I would expect the same in macOS.


Putting an alias (File > Make Alias in the Finder) of the kiota executable into /usr/local/bin does not work, even after system restart. which kiota results in "kiota not found".

Best Answer

macOS doesn‘t automagically organize /usr/local for you.

You can do one of the following, depending on the actual need:

  • Put the binaries or scripts directly into /usr/local/bin,
  • Put the package into its own directory (under /opt, /usr/local/opt or wherever you prefer), and run cd /usr/local/bin; sudo ln -s /path/to/package/bin/* . (Finder aliases are not symlinks and can't be used here). This only works if the binaries introduced by the package have unique names,
  • Add the whole package to /opt and the additional bin directories to /etc/paths.d/name-of-package.

Unless the package name/directory includes a version number, symlinking (option 2) or editing /etc/paths.d/name-of-package (option 3) need to be done only once.

PS: The second option is basically what Homebrew does.