OSX Hierarchy questions and organization

applicationsdatafilesystemfolders

I've done extensive searching on these questions and have even come across others, however, they do not answer any of my questions.

  • What are ~/Library and /Library for respectively? I can see they store certain applications, but why there and not /Applications or ~/Applications? I'm confused between the 4.
  • In my personal system, I see go, git, and android-sdk directories in /usr/local for these programs. Why would these not be stored in those application or library directories I mentioned above?
  • I know this is all down to choice, but where do I store, or what is a common place to store libraries such as boost that I would use across all of my C++ programs?
  • in line with the question above, where should I store the projects/source files for my C++, Java, IOS, Android, etc. projects? I feel like my system right now is very unorganized with some projects on my desktop, home directory, etc. because of my ignorance on these things, I want to find a good, organized system.

Best Answer

OS X spawns from two different cultures: Unix/POSIX and Mac OS.

Folders like /usr, /var, /etc, the command line shell in the Terminal (bash by default) all belong to POSIX environment. Portable software targeting Unix-based systems (like git) go into /usr/local by default, or into package manager's defined location if installed by it (Homebrew uses /usr/local, MacPorts use /opt/local).

Library, Applications, /System and others belong to Mac OS specifically. Apple's software, services, and GUIs of third-party apps go there.

The ~ symbol in path is a traditional way to denote path to current user's home folder. Things that must not be seen by other user accounts go into ~/... counterpart. For example, Mail keeps emails in ~/Library, but standard stationery templates in /Library.

Library folders are supposed to be accessed by applications programmatically, not browsed by user via Finder. Since 10.9, ~/Library is hidden so that users won't unknowingly screw anything there.

There are no out-of-the-box recommendations how to store your files. They will be as good organized as you are good in organizing. They only thing to say in context of OS X is that your files must be in the home folder, but not in ~/Library, and probably not in ~/Public which exists to share files with others.