How can I access ALL of the directories in the terminal in macOS? (usr, etc, dev and so on) macOS is hiding them.

Is it possible to access them in the Terminal program on macOS, or does Apple not allow that? If so, do I need to use an aftermarket terminal program?

I can't find the answer to this by Googling it. I just called Apple technical support and they won't tell me how to do it. They said they don't want people messing around in their operating system. I will have to buy another computer eventually, but I just can't afford to right now. If someone would be kind enough to help me I would appreciate it.

  • 1
    “If so, do I need to use an aftermarket terminal program?” You know, what exactly is your question? I can access any directory I want on macOS 10.3.5 via ls -la or sudo ls -la if it requires admin access. So I am utterly baffled at this question’s premise. Jul 5 '18 at 13:29
  • It isn't clear what you mean by "access". Access to accomplish what purpose?
    – fixer1234
    Jul 6 '18 at 0:20
  • @fixer1234 Please look at these comments connected to the answer on this question and let me know what you think of someone thinking cd /. is a massively dangerous command. Jul 6 '18 at 0:46
  • 1
    @JakeGould, yeah, I saw the comment threads, which was what prompted my comment. It isn't clear whether the OP wants to just look at what's there or "do things" (and what things). I voted to close. But we'll be closing a more polished question thanks to your edits. :-)
    – fixer1234
    Jul 6 '18 at 1:01
  • To be fair to the original poster, when you first launch Terminal you see what is in your home directory. This is not Apple specific behavior but simply the way many Unix/Linux systems work. Additionally, when you are in the Terminal you can always cd or ls / (the root path) and that again is not Apple specific behavior. But what is Apple specific is System Integrity Protection (aka: SIP) which Apple has put in place since macOS El Capitan (10.11) which is a deeper level of system protection that some need to get around for basic work. Jul 6 '18 at 1:06

macOS hides the operating system guts for roughly the same reasons that most buildings have their wiring and plumbing hidden (inside walls and floors): partly 'cause they look ugly, and partly so people won't mess with them and wind up electrocuted and/or with water spraying all over the room. You can certainly expose the OS files on macOS if you want to, but if you mess with them without knowing what you're doing, you're likely to break things. And frankly, if you have to ask this question, you really don't know what you're doing.

You want to mess around anyway? Ok, but start with the assumption that something terrible is going to happen as a result. Do you have any important files on the Mac? Then you'd better back them up somewhere else. One backup is good, two are better (especially if they're in different formats). Also, make an installer disk (follow the Apple instructions, or use DiskMaker X) so you can erase & reinstall the OS easily if it all goes sideways.

Now, how to get at the hidden files? There are several ways:

  1. Use the Terminal application provided with macOS, in the /Applications/Utilities folder. The standard unix commands show the hidden folders you mentioned, but by default they hide files and folders that start with ".". If you want to see those, use ls -a (the "-a" means "show [a]ll") or ls -A (which shows dotfiles except for "." and "..").
  2. You can use the Finder to navigate to hidden folders if you know their paths. Choose Go menu > Go to Folder (Command-Shift-G), enter the path you want to go to (e.g. "/etc"), and click Go.
  3. Starting in macOS Sierra (v10.12), you can press Command-Shift-Period in the Finder, and it'll toggle visibility of normally-hidden files and folders.

Note that none of these bypass file permissions restrictions. For that, you need something like sudo in Terminal, or any of the various operations that the Finder lets you do by entering your admin name & password. There are also some operations that System Integrity Protection forbids even with an admin override; you can disable this, but I don't recommend it.

  • What is this answer? Can’t it all be summed up as “Just use sudo ls -la instead of plain ls -la”? Jul 5 '18 at 5:02
  • @Codehead Actually, macOS doesn't have a /user directory. There's /Users and /usr (and in recent versions, /home), but no /users. And the only way I know to install Kali with macOS is to partition the drive, and install Kali on a separate partition. You can't install it under macOS, because it's a different OS. Jul 5 '18 at 6:15
  • I did partition my drive, but OSX didn't like it and crashed my machine. I'm going to try to run Metasploit in OSX and see what happens. If it doesn't work, then I'll have to wait until I get a Windows machine. I'm really beginning to dislike Apple....
    – Codehead
    Jul 5 '18 at 6:20
  • 1
    @Codehead “If anyone wants to know, just private message me.” There is utterly no private messaging on this site. If you have discovered an answer, post an answer and allow others to learn. Place a warning if you wish. But I find it utterly incredulous that somehow you found some magical way to access directories that is not already documented online somewhere. Jul 5 '18 at 13:31
  • 1
    @Codehead You have to be trolling the site or really unknowledgeable. If you want to see “hidden directories” and such by the method you describe you can do the same thing by typing: cd /. There is no way your “magical” command and mine will damage anything. All / means is root directory. This is nothing new. Has nothing to do with Apple or macOS or anything. It’s the same on every *nix/Linux system. This question should be closed based on this trail of comments alone. Jul 5 '18 at 21:17

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