Skip to main content

Is there a way to show ~/Library by default on Lion machines?
In the User Templates it is unhidden,
so the hidden flag must be set when a user account is created.



I know that i can change it on a per-user basis,
i'd like to change it system-wide though if possible,
so when a user logs in for the first time his ~/Library folder is already unhidden.



Currently the only way i see to accomplish this is a separate policy running the chflags command on login once per user.



Any other ideas?

I've got a LaunchAgent/script combo that fixes this issue:



https://github.com/rtrouton/rtrouton_scripts/tree/master/rtrouton_scripts/lion_show_user_library


Nice one, thanks!


The OS by default in 10.7 sets a flag to hide ~/Library, shown here:



bash-3.2$ pwd
/Users/tlarkin
bash-3.2$ ls -alO
total 24
drwxr-xr-x+ 14 tlarkin staff - 476 Feb 20 14:30 .
drwxr-xr-x 5 root admin - 170 Feb 20 08:57 ..
-rw------- 1 tlarkin staff compressed 3 Feb 20 08:57 .CFUserTextEncoding
-rw-r--r--@ 1 tlarkin staff - 6148 Feb 20 14:30 .DS_Store
drwx------ 2 tlarkin staff - 68 Feb 20 09:44 .Trash
-rw------- 1 tlarkin staff - 12 Feb 20 14:12 .bash_history
drwx------+ 3 tlarkin staff - 102 Feb 20 08:57 Desktop
drwx------+ 6 tlarkin staff - 204 Feb 20 14:30 Documents
drwx------+ 5 tlarkin staff - 170 Feb 20 11:11 Downloads
drwx------@ 34 tlarkin staff hidden 1156 Feb 20 14:41 Library
drwx------+ 3 tlarkin staff - 102 Feb 20 08:57 Movies
drwx------+ 3 tlarkin staff - 102 Feb 20 08:57 Music
drwx------+ 4 tlarkin staff - 136 Feb 20 08:57 Pictures
drwxr-xr-x+ 5 tlarkin staff - 170 Feb 20 08:57 Public


So, just using chflags you can change it, with a one liner.



chflags nohidden ~/Library

Hi,
Does this work with Network Accounts via Open Directory? I tried putting this in the main Library folder and could not get it to work. Is there a way to make it a policy?



Thanks,



Eric


OK, I can't seem to accomplish this via script… This command has to be runs as the current logged in user, correct?



I perused the old mail list entries about running a command as the current user. I tried these:



#!/bin/sh
current_user=defaults read /Library/Preferences/com.apple.loginwindow.plist lastUserName
sudo -u "$current_user" chflags nohidden ~/Library/



#!/bin/bash
user=ls -l /dev/console | cut -d " " -f 4
/usr/bin/su $user chflags nohidden ~/Library/



#!/bin/bash
CurrentUser=/bin/ls -l /dev/console | usr/bin/awk '{ print $3 }'
# now execute unit commands as that user
/usr/bin/su $CurrentUser chflags nohidden ~/Library/
exit 0



None worked via Casper Remote.



What am I doing wrong?


Why not just run the following as a Login Script running once per user. You would need to put a policy flush in your imaging routine but I think that should be done anyways.



#!/bin/bash 
chflags nohidden ~/Library

Matt, this command has to be run as the current logged in user.


Run a script that touches the User Template folder.


Reply