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
/var folders are merely symbolic pointers to
/private/var respectively. You can verify this by using readlink as
/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,
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 like
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:
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.
/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.
/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.