Where is the list of hidden folders kept?
October 24, 2007 2:24 PM   Subscribe

Mac OS X filter: In terminal, if I go to / and ls, I see a bunch of folders that are hidden in Finder, for example /etc, /private, /sbin, and so on. How do I add a folder to that list?

In the dark recesses of my memory I remember there being some kind of file somewhere that contains a list of the paths that the Finder should hide, but my Google-fu is failing me and I can only find people telling me how to turn ON the "show hidden files and folders" option, which isn't what I want at all!

If you care, it's because I have a /sw folder that Fink created, that I want to be hidden too. Any pointers greatly appreciated.
posted by jon4009 to Computers & Internet (8 answers total) 6 users marked this as a favorite
 
Best answer: There used to be a file you could edit, and I think it still works, but the approved way now is to use /Developer/Tools/SetFile. For example:

/Developer/Tools/SetFile -a V /sw

It should grey the icon immediately, but you'll need to logout/login to see the real change.
posted by sbutler at 2:43 PM on October 24, 2007


create a folder from the command line with a period at the start and finder won't 'see' it:

> mkdir .pr0n
for example
posted by ReiToei at 2:43 PM on October 24, 2007


my bad... if you're doing it from root, you'd have to use

> sudo mkdir .pr0n

and enter your password
posted by ReiToei at 2:45 PM on October 24, 2007


The old way was with a file named '.hidden'. The new way is with attributes on the specific files.

To set the hidden flag on sw, you'd do "chflags hidden /sw".

(I think SetFile will probably boil down to the same thing, but chflags comes with the system and doesn't require that you install the dev tools.)
posted by xil at 2:49 PM on October 24, 2007


xil: is that a Leopard thing? On 10.4 I get "chflags: invalid flag: hidden".
posted by sbutler at 2:52 PM on October 24, 2007


Response by poster: The SetFile thing worked perfectly (although it only works in you have Xcode installed it seems). I had to stick a sudo in front of it as the folder was owned by root... thanks sbutler!

I knew about the . to make hidden files and folders... unfortunately I wanted to hide a folder that already existed that I didn't have control over or couldn't change later.

Also thanks to xil for preventing my continued mental anguish about the file I remembered editing ages ago ;) chflags doesn't seem to work though.
posted by jon4009 at 2:54 PM on October 24, 2007


The SetFile thing worked perfectly (although it only works in you have Xcode installed it seems).

SetFile is only installed with the dev tools; it's not part of the standard OS install.
posted by Mikey-San at 5:02 PM on October 24, 2007


You can also make a hidden file from the finder when you have hidden files set to be shown.
posted by ooklala at 6:07 PM on October 24, 2007


« Older Am i too old for MBA   |   Where do I find first-generation tech immigrants? Newer »
This thread is closed to new comments.