Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to create ultra/super hidden folder in OS X.

In Windows there are possibilities to create a super hidden folder, for example, using

attrib +s +h Hidden

the "Hidden" folder will be hidden.

Is there any command in OS X to create a hidden folder?

share|improve this question

migrated from stackoverflow.com Sep 30 '11 at 14:25

This question came from our site for professional and enthusiast programmers.

4 Answers 4

Prefixed with a dot

As in all Unix/Linux systems, a file starting with a dot is generally hidden in desktop managers (thus, Finder) and "normal" folder listings done through a shell (ls). Listing a folders contents with ls -a however reveals those files.

For example, a normal listing:

charon:portal werner$ ls -l
total 56
-rw-r--r--@  1 werner  staff   920 Aug 17 12:58 Gemfile

… and with the "all" option:

charon:portal werner$ ls -la
total 96
drwxr-xr-x  25 werner  staff    850 Sep 14 16:08 .
drwxr-xr-x@  9 werner  staff    306 Jun 15 14:57 ..
-rw-r--r--@  1 werner  staff  12292 Sep 20 15:46 .DS_Store
drwxr-xr-x  15 werner  staff    510 Sep 28 22:24 .git
-rw-r--r--   1 werner  staff     51 Aug 17 13:38 .gitignore
-rw-r--r--@  1 werner  staff    920 Aug 17 12:58 Gemfile

The Finder in OS X can also show files and folders that were hidden by the dot prefix by entering:

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

This can be reversed by exchanging TRUE to FALSE, obviously.


Changing the "hidden" flag

You can change the "hidden" flag of a file or folder by using the following commands:

chflags hidden some-file
chflags nohidden some-file

Hiding a file with flags will, as above, obviously only hide it from Finder itself. You will still be able to see the file with ls. If you want to see which are really hidden, you can check these flags with ls -lO:

charon:~ werner$ ls -lO
total 0
drwxr-xr-x  11 werner  staff  -       374 May 13 16:43 Binaries
drwx------+  8 werner  staff  -       272 Sep 30 09:48 Desktop
drwx------+ 10 werner  staff  -       340 Sep 25 21:38 Documents
drwx---r-x+ 11 werner  staff  -       374 Sep 30 15:46 Downloads
drwx------@ 18 werner  staff  -       612 Sep 30 14:02 Dropbox
drwx------+ 53 werner  staff  -      1802 Sep 29 20:04 Library
drwx------+  6 werner  staff  -       204 Sep 25 21:38 Movies
drwx------+  8 werner  staff  -       272 Sep 25 21:38 Music
drwx------@ 12 werner  staff  hidden  408 Sep 26 10:31 Pictures
drwxr-xr-x+  6 werner  staff  -       204 Sep 25 21:38 Public
drwxr-xr-x@  5 werner  staff  hidden  170 Sep 25 21:38 Sites

This will show "hidden" on all files hidden from Finder.


Of course, you can still open any of these files.

  • Through the terminal, by typing

    open some-file
    
  • In Finder, going to Go » Go to Folder …, and entering the full path.

There is no "real" way to hide a file forever, or even hide it from the shell. At least for a user without access to a shell, these would be invisible.


Hiding a folder from other users

You can hide an entire folder from another user on the system. Set its permissions to full access for yourself and remove the permissions for others, by typing:

chmod 700 some-folder

This folder will be invisible and not readable from other users, but it's not a very practical thing to do.

share|improve this answer

You can make any folder or file in OS X hidden by adding hidden flag.

chflags hidden /path/to/folder/

and to show it again

chflags nohidden /path/to/folder/
share|improve this answer

I'm not sure they have an counterpart to the Windows system files attribute (as +S stands for)

read more here: http://www.westwind.com/reference/os-x/invisibles.html

"In Mac OS X, there are three different ways a file or directory can be made invisible in the finder: it can have the "invisible" attribute set (as in older Mac OS systems), its name can start with "." (as in other unix systems), or its name can be listed in the /.hidden file. Many of the files and directories listed above are actually invisible for multiple reasons (e.g. /bin is listed in /.hidden, as well as having its invisible attribute set).

Note that OS X only respects the .hidden file on its boot volume, so if you boot from another disk, several normally-hidden files will suddenly be visible. Also, since Mac OS 9 (and older versions) only recognize the invisible flag, even more of these files (mainly /.vol, /mach, /mach.sym, and sometimes .DS_Store) will be visible when you boot into Mac OS 9."

share|improve this answer
    
Thanks Allman, but i was tried and also referred this site. –  BenDennison Sep 30 '11 at 14:29

Adding on to @slhck's answer, you can hide the folder inside another file with steganography tools, and then hide/encrypt that file using methods mentioned here. Even if certain file managers/browsers are able to find the hidden file, the hidden folder will not be shown.

Here is a SuperUser question on steganography tools.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.