Are there Apple guidelines for where user shell tools in Mountain Lion should be installed? Some (e.g. TeX, or Apple's Git) end up in /usr
, and others (e.g. X11) seem to end up in /opt
(sometimes with a symlink from /usr
), while others (e.g., Git) end up in /user/local
, and I wonder what the difference is, and whether one is preferred over the other.
-
1Which OS X version?– Global nomadCommented Feb 3, 2013 at 18:07
-
Good question; fixed.– oromeCommented Feb 3, 2013 at 18:08
-
3Does this answer your question? Where should I store command line applications?– mmmmmmCommented Jul 17, 2020 at 9:31
1 Answer
The Filesystem Hierarchy Standard is followed in Linux and other Unix based OSes, and OS X follows this too, to a large extent. The /private
folder is where basically your OS X core resides and the /etc
and /var
folders are merely symbolic pointers to /private/etc
and /private/var
respectively. You can verify this by using readlink as readlink /etc
.
The /opt
folder is for additional user applications and so is /usr/local
, and you can choose to install to either one of them. It really doesn't matter (as long as you take care of adding to your paths appropriately) and the main intent is to keep it insulated from operating system upgrades (which will overwrite stuff in, say, /bin
).
Oftentimes, the following "loose convention" is adopted:
if the package/application follows unix standards, then install it to
/usr/local/
. There will be no surprises in the package and you can definitely expect a sub-directory structure likebin
,etc
,include
,share
, and so on.if the software comes packaged as a standalone application in which the sub-directory structure is arbitrary, you simply install it to
/opt
. On my machine, I have my VPN,cisco
installed in/opt
and it has the following directories:anyconnect
,hostscan
,vpn
. None of these are unix compliant folders and installing it to/usr/local
would not be a good idea.
They both have their "advantages" and "disadvantages", depending on how you view it and what your familiarity with unix is.
Installing to
/usr/local
is "convenient" in that if you simply add/usr/local/bin
to your path, everything else is set and you don't need to modify anything if you add a new application. On the other hand, if you need to remove something, it's a pain because all programs are clumped together and you don't remember which binaries were installed for application X and which ones for application Y.Installing to
/opt/programX
will require you to manually add it to the path and perhaps setup symlinks, but removing an application is convenient, because you simply need to remove the folder and you're done.
-
1Two questions: (1) why does TeX (as
texbin
) get put in/usr
rather than/usr/local
and (2) what does "basically where your OS X core resides" mean (private
seems to be mostly about settings)?– oromeCommented Feb 3, 2013 at 18:27 -
2Perhaps "core" was the wrong choice of word (since it gave the impression that all of it resided there), but what I wanted to convey is that it is part of your OS and you shouldn't tinker with it. Of course, this is pointless now as you have removed it from your question in an edit. As for
texbin
, it's a convention that they've adopted and stick to (nothing wrong with that). There's also a/usr/local/texlive
, where the packages are installed to.– rm -rfCommented Feb 3, 2013 at 18:33 -
1
-
1