Set Show Library Folder via defaults from command line Is there anyway to activate the Show Library Folder option from the command line?

I know that I can unhide it with the command chflags nohidden ~/Library', but for several reasons I would prefer a defaults command.
The way to answer this question in general is to change the setting you're interested in and see what file changed. Then see what changed in the file.

Open your Preferences folder (~/Library/Preferences) and put it in List view, sorted with most recently modified files on top. Open your home folder in a different window, open the Show View Options palette, and toggle Show Library Folder. Did any preference file move to the top in the list view?

Chances are com.apple.finder.plist did. As we'll see, though, this is a false positive. Finder is constantly fiddling with its defaults. But we don't know that yet, so lets assume that this is the plist where the setting is being saved.

In Terminal, enter the commands:

cd ~/Desktop
defaults read com.apple.Finder &gt; before.txt


This will write Finder's current preference settings to a text file. OS X has always cached preferences in RAM, but OS X 10.10 Yosemite has gotten very aggressive about this. There's no guarantee how soon a changed setting will get pushed to com.apple.finder.plist, but no matter. We're not reading the file. By using the defaults command we're going straight to the horse's mouth, and getting the settings as cached in RAM.

Now toggle the view setting, and capture Finder's new preferences in a new file:

defaults read com.apple.Finder &gt; after.txt


To see what changed, enter the Terminal command:

diff before.txt after.txt


Surprise! There's no output, meaning that nothing changed. Finder does not save this setting using the preferences system, so you can't set it using defaults.

This isn't too surprising. Most view settings are stored in a .DS_Store file. Not all of them, so this could have gone either way. Some folders (the "Computer" folder, for example) have their settings stored as preferences rather than in .DS_Store, so there was a chance this setting would be stored there too, but that hope didn't pan out in this case.