76

Apparently, the Macintosh HD icon on the desktop points to the root directory but it is not showing all the contents.

Some of the files and directories are the same as those which I see when I perform an ls on / dir in Terminal, but most other directories like /usr, /bin, etc are not visible.

I'm assuming that for security, Mac OS X isn't showing the rest of the files and directories. Is there a way to change this behavior so as to make it like we view root folder in Linux?

Edit: just found the following here:

The Finder and the Terminal show different contents for the root directory. Some items in the root directory are not visible in the Finder. This reduces visual clutter and enhances simplicity. If you are familiar with a UNIX-style command line you can use Terminal to view all items in a directory.

As per this note, Terminal has to be used to view all the items. So, what do others do? Use terminal or there is some other way?

  • 8
    "Reduces visual clutter and enhances simplicity" Apple makes it even more difficult for advanced users. – MikeMurko Sep 21 '14 at 0:26

11 Answers 11

48

Enter in Terminal:

sudo chflags nohidden directoryname

Whereby directory name is the name of the directory that you want to see in Finder.

Reverse this by typing:

sudo chflags hidden directoryname

The Macintosh HD basically resembles the root directory. If you want it to appear on the desktop and in finder change this in the finder preferences.


Showing all files in Finder

Type in the terminal

defaults write com.apple.finder AppleShowAllFiles TRUE

Then log out and back in.

  • doesn't seem to be working... I typed sudo chflags nohidden / Did I type it correct? Do I have to logout and login again? – Atul Goyal Dec 28 '11 at 20:45
  • The root directory is Macintosh HD which you can show on the desktop or the sidebar of a finder window. The command surely works for any subdirectory! If you want to have the root directory appear visible in the finder you need to edit the system settings. I'll edit my answer to visualize this. – gentmatt Dec 28 '11 at 20:51
  • 1
    As I said in my question, I CAN see the Macintosh HD and even its contents, the problem is that after I open Macintosh HD which is supposed to be the root dir, it just shows only few directories and not all the directories like bin, usr, sbin, etc., which are present in the root (and can be seen when u do cd / and then ls. – Atul Goyal Dec 28 '11 at 21:01
  • Well, you can make anything visible by typing defaults write com.apple.finder AppleShowAllFiles TRUE. Then logout and back in. However, the originally hidden files are greyed out. Still, you can open them. – gentmatt Dec 28 '11 at 21:10
  • no even defaults write com.apple.finder AppleShowAllFiles TRUE is not working. – Atul Goyal Dec 28 '11 at 21:15
65

Shift-Command-G in Finder brings up a "Go to folder" dialog. Type in the name of the directory, for example, /usr/local. Finder will show the directory. I use this with Finder in 'View as Columns'

While this doesn't give a browsable directory from the root directory down, I've found it quite useful.

  • This! It enabled me to upload /usr/local/bin/ files to Virus Total for virus scanning. I couldn't have done that with the totalitarian default settings, without this hidden shortcut. Sometimes MAC OS X shoots itself in the foot. – Dan Dascalescu Sep 12 '16 at 20:00
  • Sweet, it works in picker windows, too! I used it in the Automator's Launch App action to find an app tucked away in /usr/local/bin. – Jacktose Sep 13 '16 at 1:04
6

The problem with using sudo chflags nohidden / is that it will unhide the root directory (which is already visible)... but you want to unhide particular folders that are inside the root directory. Which is why sudo chflags -R nohidden /* will work.

But that will make everything in the root directory visible.

Personally, I didn't want to make everything visible, just the /usr directory.

So I used sudo chflags nohidden /usr

2

Change the command to:

sudo chflags -R nohidden /*

There is a danger in this of course. The converse will hide everything. So your best bet is to do:

ls -lo

to list the files you want to see.

2

I'd like to update this with some pertinent information relevant to El-Capitan. The top-voted responses (which worked well in the past), don't seem to work anymore. I keep getting "Operation not permitted" responses when trying to use the suggested schflags command for the /usr directory, for example.

This seems to be by design, as a new security paradigm by Apple removes the ability of an administrator to change certain flags on key system directories.

A good workaround that I found (that addresses the original question) is simply to use the Go To Folder option (cmd-shift-G) to go directly to the needed directories (I like to have /usr, /var, and /etc visible in Finder), and then just drag those over to your Favorites bar for easy access.

2

None of the above answers work for me in Sierra (version 10.12.2), but entering this command into the terminal does work and shows all hidden files everywhere (greyed out so you can see which are hidden by design), including /var, /usr, /etc, etc:

defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder

Note that this shows hidden files everywhere - I would consider this a good thing, but some people might not want to see all the hidden files scattered across their directories. The killall Finder bit simply restarts Finder so that the change immediately takes effect.

Credit to this LifeWire article, which also recommends using this command instead if you are on OS X 10.8 or earlier:

defaults write com.apple.finder AppleShowAllFiles TRUE ; killall Finder

Both commands can be undone by repeating the command but replacing true (or TRUE) with false (or FALSE).


The root directory looks like this after the change:

enter image description here

2

The 2018 (High Sierra) way for me seems to be:

  1. open Finder
  2. Open preferences
  3. Go to Sidebar
  4. Add whatever you want
  • This is already included in other answers here :-) – nohillside Aug 5 '18 at 9:18
  • quite right you are :) – sapo_cosmico Aug 5 '18 at 12:29
-1

Go to Finder->Preferences... On Sidebar tab find your Mac name in DEVICES section. Set it checked. Then close Preferences and review Finder sidebar. Is your Mac name appeared in DEVICES section? Is Main Partition folder inside? That's the root directory! (this worked not on all Macs for me - sometimes Main Partition was not enlisted)

-2

Try this :

Open Finder > Preferences > Devices (Check the name of your Mac)

Hope this can help.

  • 2
    This doesn't help in using the Finder to browse through /usr etc. – nohillside Aug 6 '12 at 19:49
-2

You can install kde4-baseapps with MacPorts and use Dolphin alongside Finder. Finder is garbage... Dolphin is ok.

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

-3

Pressing Command+Up will go up 1 level to reveal the root directory.

  • 2
    This doesn't make system directories visible though – nohillside Dec 30 '13 at 7:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .