what does mac os /Library folder store?

I am a new to mac osx. One thing confusing me is what does /Library or /System/Library folders store? As its name meaning, I thought is should be something like /lib or /usr/lib in Linux. However, it does not. Inside it, it looks more similar to application bundles. And all naming is very application-specific, like /Library/iChat. If they are application-specific, then why they are called Library? Usually when named as Library, it is for codes or resources sharing purpose.

See—The Library Directory Stores App-Specific Files…—here:
developer.apple.com/library/arc … 72-CH2-SW1

(I’m not a developer. I was curious about the subject when I started using OS X/macOS. A mod will likely move this thread to the appropriate location.)

Part of the mystery is solved by knowing that a Mac is really a BSD UNIX, and so it also has /lib, /usr and /etc. So a direct comparison to these directories is not possible. In addition to the plethora of open source stuff that is pre-installed (Apache, Ruby, etc.), anything from the *NIX world you install yourself will most likely use these folders as well.[size=80][1][/size]

You won’t find them in Finder, Apple deems them to be hidden files, but you can get to them in Finder via the Go ▸ Go to Folder… command. I prefer just using the shell if I need to work in those areas though. If you’re used to Linux, it’s worthwhile doing an ls ▸ to check out familiar areas, like /var and /tmp. Ultimately you will find macOS is not so plain-text configuration file friendly, which is a shame, but chances are if you know how to do a thing with /etc, it might work on a Mac.

As for Library folders, the referenced documentation is the best answer. They tend to be more of a combination of the lib and etc folder conventions in a typical *NIX. The need for storing a host of support files for programs into folder structures is of less necessity on a Mac, thanks to the bundle mechanism. Much of what you’d need to install into these folder structures can simply be self-contained.

A good way of describing the difference is that Apple will use both /Library and /System/Library for configuration, but only Apple will use the latter, and it tends to use it only for critical or static components of the OS (like Finder.app, and fonts that if deleted would cause the system to stop working). You generally never need to go in there unless Apple miscalculates what should be considered static (for example, I think the default new user folder structure should most certainly not be considered a hard-coded part of the operating system, but there it is in /System/Library/User Template, and locked down as hard as you’d expect the kernel to be, for some reason).

I believe that nomenclature comes from its NeXT heritage, where Library is used to hold all of the stuff that isn’t what you’d typically open and save as data yourself, as well as anything that particular pieces of software require to function (like the more traditional use of the word “library”). The user ~/Library folder in particular can be very useful to become acquainted with. Scrivener for example will store your presets, custom icons and even backup files by default, into ~/Library/Application Support/Scrivener. It’s a good place to go if you want to customise something about a program that is a bit more technical, as you will often find themes, scripts and other useful things in these Application Support subfolders.


[size=80][1] And speaking of which, check out Homebrew. It’s a package manager for macOS that focusses foremost *NIX level stuff, but also has a lot of wrapper packages for commercial stuff—you can even install Scrivener with ‘brew cask install scrivener’. macOS also comes with pip and gem for Python and Ruby extensions, too.[/size]