99

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?

1
  • 12
    "Reduces visual clutter and enhances simplicity" Apple makes it even more difficult for advanced users.
    – MikeMurko
    Commented Sep 21, 2014 at 0:26

13 Answers 13

58

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.

10
  • 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
    Commented Dec 28, 2011 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
    Commented Dec 28, 2011 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
    Commented Dec 28, 2011 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
    Commented Dec 28, 2011 at 21:10
  • no even defaults write com.apple.finder AppleShowAllFiles TRUE is not working.
    – Atul Goyal
    Commented Dec 28, 2011 at 21:15
90

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.

2
  • 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. Commented Sep 12, 2016 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
    Commented Sep 13, 2016 at 1:04
8

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

6

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
0
4

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

1
  • I use 1 or 0 instead of -boolean true or false, and it works just fine.
    – SilverWolf
    Commented Oct 12, 2018 at 17:35
3

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.

1

What worked for me is that while in Finder I pressed Cmd + Shift + ..

-1

There are other file managers available. I enjoy using Dolphin. You can install kde4-baseapps with MacPorts it contains Dolphin. I could not use finder.

-1
  1. In the Finder on your Mac, choose Finder > Preferences.
  2. Click General, then select the items you want to see on the Desktop. For example, if you select “Hard disks” icons for your hard disks appear on your desktop.
  3. Click Sidebar, then select the items you want to see in the Finder sidebar.

Some items are listed below Favorites and others are listed below Locations.

Reference: Visit Apple Support

-2

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)

-3

Try this :

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

Hope this can help.

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

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

1
  • 2
    This doesn't make system directories visible though
    – nohillside
    Commented Dec 30, 2013 at 7:51

You must log in to answer this question.

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