How to see hidden files and folders in macOS

Posted:
in macOS edited July 2018
While macOS allows users to see the majority of the files their Mac holds, not all files are immediately accessible in Finder, with some kept from view to prevent inadvertent changes or deletion. AppleInsider shows how to gain access to those hidden files and folders.




Operating systems typically have some form of file-hiding functionality built in, and macOS is no exception. Many files or folders are hidden all across the Mac's file system, with the main goal of preventing curious users from mistakenly deleting an important folder or changing a critical file that could cause major problems to macOS.

Not everything hidden by macOS is that hazardous, as apps are also using the feature to help preserve a user's work. For example, a word processor could create a temporary copy of a file currently being used, or a file to flag that another file in a folder needs to be protected from other activities while it is in use elsewhere.

For the adventurous, it is possible to gain access to the hidden files and folders, but the process will differ depending on the operating system, and if you want to have permanent access to said files.

Keyboard Shortcut

Apple has included an easy way to see the files for those using macOS Sierra and newer releases. A keyboard shortcut can be used to toggle between making the files visible or hiding them again.

Open Finder and navigate to the folder you wish to use. Press the key combination Command-Shift-. (Period) to toggle between the two states.


Terminal

This method is meant for macOS versions older than Sierra, but will also work in both Sierra and High Sierra.

Open the Terminal. This can be found by opening the Finder, selecting Applications, then the Utilities folder.

Enter the following string into the terminal, then press enter:
defaults write com.apple.finder AppleShowAllFiles true; killall Finder



This string performs two tasks. The first section before "true" alters a setting within macOS to automatically show all files. The second "killall Finder" element effectively restarts the Finder, refreshing your view to show hidden files.

If you wish to reverse the setting, open Terminal and enter the same command, except changing "true" to "false" in this way:
defaults write com.apple.finder AppleShowAllFiles false; killall Finder
Again, press enter.

Further Thoughts

The files and folders are typically hidden for a very good reason, namely to prevent anyone from accidentally meddling with their operating system and applications in a potentially catastrophic way. Generally speaking, it's best to leave these files alone unless there is a good reason to access them.

If you do feel the need to meddle with these hidden items without any constructive purpose, it is advised to avoid doing so on any mission-critical systems, and to make backups beforehand, just in case any data is lost.
magman1979
«1

Comments

  • Reply 1 of 23
    backstabbackstab Posts: 138member
    Nope. Not getting the toggled view.
    What am I missing?

    edit: I got it. Requires viewing system level folders in Finder. (I could sworn "all / any' folders had at least 1 or 2 invisibles. guess not anymore)
    edited July 2018
  • Reply 2 of 23
    MacProMacPro Posts: 18,011member
    OMG That is Sooo easy thank you.  I never knew that!  Command Shift Period works so much faster than using Transmit which is how I've been doing it for years!
    magman1979StrangeDays
  • Reply 3 of 23
    blastdoorblastdoor Posts: 1,889member
    MacPro said:
    OMG That is Sooo easy thank you.  I never knew that!  Command Shift Period works so much faster than using Transmit which is how I've been doing it for years!
    I wonder how many more of these little gems are lurking in OSX. 

    I only recently realized that by holding 'option' while right-clicking on a file in the Finder, you can copy the pathname of a file rather than the file itself. 
  • Reply 4 of 23
    Mike WuertheleMike Wuerthele Posts: 4,199administrator
    blastdoor said:
    MacPro said:
    OMG That is Sooo easy thank you.  I never knew that!  Command Shift Period works so much faster than using Transmit which is how I've been doing it for years!
    I wonder how many more of these little gems are lurking in OSX. 

    I only recently realized that by holding 'option' while right-clicking on a file in the Finder, you can copy the pathname of a file rather than the file itself. 
    There are literally thousands of them.
    magman1979
  • Reply 5 of 23
    blastdoorblastdoor Posts: 1,889member
    I was hoping this would involve an AR app on the iPhone --- point your iPhone camera at your Mac screen and suddenly you see all the hidden files ;-) 
    Cesar Battistini Maziero
  • Reply 6 of 23
    mknelsonmknelson Posts: 296member
    That's a handy tip.

    I had used the terminal command several years ago in either Yosemite or El Capitan and couldn't get it to revert until I installed the next OS. The shortcut seems a lot safer.
  • Reply 7 of 23
    SoliSoli Posts: 8,550member
    Maybe of us don't need to see every hidden file because it just uglies up Finder and can make it harder to find items, while at the same time many of us still need frequent access to ~/Library/. You can do that with Terminal:

    chflags nohidden ~/Library/; killall -KILL Finder
    edited July 2018 Alex1N
  • Reply 8 of 23
    backstabbackstab Posts: 138member
    Soli said:
    Maybe of us don't need to see every hidden file because it just uglies up Finder and can make it harder to find items, while at the same time many of us still need frequent access to ~/Library/. You can do that with Terminal:

    chflags nohidden ~/Library/; killall -KILL Finder
    Why bother with that. Library folder is right under the Go Menu + Option key (just like any other Option Menu item) any time you need it.
    Can also just keep Go to folder... field loaded with "~/Library"
    Alex1N
  • Reply 9 of 23
    SoliSoli Posts: 8,550member
    backstab said:
    Soli said:
    Maybe of us don't need to see every hidden file because it just uglies up Finder and can make it harder to find items, while at the same time many of us still need frequent access to ~/Library/. You can do that with Terminal:

    chflags nohidden ~/Library/; killall -KILL Finder
    Why bother with that. Library folder is right under the Go Menu + Option key (just like any other Option Menu item) any time you need it.
    Can also just keep Go to folder... field loaded with "~/Library"
    If you want to go through all that extra work every time you want to access ~/Library/ you go right ahead, but for people that access it often through Finder it's much more efficient to have the file already visible in our ~/ folders.
    Alex1N
  • Reply 10 of 23
    fastasleepfastasleep Posts: 2,423member
    Thanks, I didn't know about that keyboard shortcut! This will be handy for quick access to local copies of .htaccess files.

    This reminds me though, and I usually see this in Terminal, I come across folders like ".124WKT21JC3EJC" that have a single file in it with similar names like "UTNOV810RRJ8Q" that have ~600 bytes of gibberish text when opened in BBEdit. This one in particular is from 2010 and in my Desktop folder. 

    I'm going to make a wild guess and assume it's some garbage temp file created by Adobe software or something that never gets cleaned up, but wondering if anyone has actual insight into where these kinds of things come from. 
  • Reply 11 of 23
    backstabbackstab Posts: 138member
    Soli said:
    backstab said:
    Soli said:
    Maybe of us don't need to see every hidden file because it just uglies up Finder and can make it harder to find items, while at the same time many of us still need frequent access to ~/Library/. You can do that with Terminal:

    chflags nohidden ~/Library/; killall -KILL Finder
    Why bother with that. Library folder is right under the Go Menu + Option key (just like any other Option Menu item) any time you need it.
    Can also just keep Go to folder... field loaded with "~/Library"
    If you want to go through all that extra work every time you want to access ~/Library/ you go right ahead, but for people that access it often through Finder it's much more efficient to have the file already visible in our ~/ folders.
    Yes. A single 'click' up there on the menu bar can be quite a bother.
  • Reply 12 of 23
    MacProMacPro Posts: 18,011member
    blastdoor said:
    MacPro said:
    OMG That is Sooo easy thank you.  I never knew that!  Command Shift Period works so much faster than using Transmit which is how I've been doing it for years!
    I wonder how many more of these little gems are lurking in OSX. 

    I only recently realized that by holding 'option' while right-clicking on a file in the Finder, you can copy the pathname of a file rather than the file itself. 
    And I only last year discovered that sort by a single attribute in a folder requires doing twice, once without option held then again with option to align the same attribute or else you have a sub sort you may unaware of.  It used to drive me nuts until I found this out.  This was embarrassing after starting with on Macs in 1984 lol. Let's just forget about Apple ][s for now :)
    Alex1N
  • Reply 13 of 23
    MacProMacPro Posts: 18,011member

    backstab said:
    Soli said:
    backstab said:
    Soli said:
    Maybe of us don't need to see every hidden file because it just uglies up Finder and can make it harder to find items, while at the same time many of us still need frequent access to ~/Library/. You can do that with Terminal:

    chflags nohidden ~/Library/; killall -KILL Finder
    Why bother with that. Library folder is right under the Go Menu + Option key (just like any other Option Menu item) any time you need it.
    Can also just keep Go to folder... field loaded with "~/Library"
    If you want to go through all that extra work every time you want to access ~/Library/ you go right ahead, but for people that access it often through Finder it's much more efficient to have the file already visible in our ~/ folders.
    Yes. A single 'click' up there on the menu bar can be quite a bother.
    I just drag my ~Library to the left side Finder short cuts menu and it's always there.
    Alex1N
  • Reply 14 of 23
    MacProMacPro Posts: 18,011member

    Thanks, I didn't know about that keyboard shortcut! This will be handy for quick access to local copies of .htaccess files.

    This reminds me though, and I usually see this in Terminal, I come across folders like ".124WKT21JC3EJC" that have a single file in it with similar names like "UTNOV810RRJ8Q" that have ~600 bytes of gibberish text when opened in BBEdit. This one in particular is from 2010 and in my Desktop folder. 

    I'm going to make a wild guess and assume it's some garbage temp file created by Adobe software or something that never gets cleaned up, but wondering if anyone has actual insight into where these kinds of things come from. 
    Host files both in macOS and Windows 10 are the hidden files I access all the time, this is where I'll love this short cut.

    As to cleaning up Adobe's mess there is a sweet little app called AppCleaner https://freemacsoft.net/appcleaner/ that lets you drag an application onto it and it lists everything associated with that app, hidden or otherwise.  You choose what to delete or keep.  I've used it for years and it is not to be confused with malware like MacCleaner et alia.
    edited July 2018
  • Reply 15 of 23
    MacProMacPro Posts: 18,011member
    blastdoor said:
    MacPro said:
    OMG That is Sooo easy thank you.  I never knew that!  Command Shift Period works so much faster than using Transmit which is how I've been doing it for years!
    I wonder how many more of these little gems are lurking in OSX. 

    I only recently realized that by holding 'option' while right-clicking on a file in the Finder, you can copy the pathname of a file rather than the file itself. 
    There are literally thousands of them.
    Bed time reading tonight .... https://support.apple.com/en-us/HT201236
    Seriously though you guys are coming up with stuff not in Apple's list.  Not to mention Apple don't even mention resetting the SMC in the 'start up options section' which has saved my bacon a few times over the years.
    edited July 2018 Alex1N
  • Reply 16 of 23
    SoliSoli Posts: 8,550member
    backstab said:
    Soli said:
    backstab said:
    Soli said:
    Maybe of us don't need to see every hidden file because it just uglies up Finder and can make it harder to find items, while at the same time many of us still need frequent access to ~/Library/. You can do that with Terminal:

    chflags nohidden ~/Library/; killall -KILL Finder
    Why bother with that. Library folder is right under the Go Menu + Option key (just like any other Option Menu item) any time you need it.
    Can also just keep Go to folder... field loaded with "~/Library"
    If you want to go through all that extra work every time you want to access ~/Library/ you go right ahead, but for people that access it often through Finder it's much more efficient to have the file already visible in our ~/ folders.
    Yes. A single 'click' up there on the menu bar can be quite a bother.
    As opposed to having it already there in the Finder window I'm using? Absolutely.

    PS: You're forgetting you need to also hold down the alt/option key after you're in the Finder app, move the mouse point up to the Menu Bar, and then click on Go, before you can even see the Library folder option.

    PPS: This will never show up in the Finder window of other apps if it's kept hidden, but you go right ahead and keep doing extra steps over a one-time copy paste in Terminal if the command line is too daunting. I can only lead you to water.
    edited July 2018 Alex1N
  • Reply 17 of 23
    danny602danny602 Posts: 24member
    We don’t need to see these hidden files, we do need to have the ability to make new files we can choose to hide if we see fit, the one thing I miss from windows that an IOS system lacks.
  • Reply 18 of 23
    Mike WuertheleMike Wuerthele Posts: 4,199administrator
    danny602 said:
    We don’t need to see these hidden files, we do need to have the ability to make new files we can choose to hide if we see fit, the one thing I miss from windows that an IOS system lacks.
    There are ways to do this on iOS, but they aren't great, and aren't cross-app visible. So, it's problematic.

    It's relatively easy to do on macOS, and we'll be talking about that in the future.

    Regarding invisible macOS files. There are troubleshooting steps that require it, and we got asked if there was a quick and easy way to do it. There is, so we talked about it. Nearly every tip we publish is in response to a user question or request.


    edited July 2018 Alex1N
  • Reply 19 of 23
    Mike WuertheleMike Wuerthele Posts: 4,199administrator

    MacPro said:
    blastdoor said:
    MacPro said:
    OMG That is Sooo easy thank you.  I never knew that!  Command Shift Period works so much faster than using Transmit which is how I've been doing it for years!
    I wonder how many more of these little gems are lurking in OSX. 

    I only recently realized that by holding 'option' while right-clicking on a file in the Finder, you can copy the pathname of a file rather than the file itself. 
    There are literally thousands of them.
    Bed time reading tonight .... https://support.apple.com/en-us/HT201236
    Seriously though you guys are coming up with stuff not in Apple's list.  Not to mention Apple don't even mention resetting the SMC in the 'start up options section' which has saved my bacon a few times over the years.
    Yeah, I don't know why that's not in the start-up options section. It should be, given that there are at least five support documents that tell you to do it, and direct you to a different, less comprehensive page.
    Alex1N
  • Reply 20 of 23
    SoliSoli Posts: 8,550member
    danny602 said:
    We don’t need to see these hidden files, we do need to have the ability to make new files we can choose to hide if we see fit, the one thing I miss from windows that an IOS system lacks.
    You can easily do this. I've already posted how you can do this with a simple command in Terminal and there are many 3rd-party apps available too. Here's one...


    You can even build your own with Automator app in 2 minutes since it's just a simple adjusting of the flags. If just a file, you don't even need to kill Finder to have the changes take effect.

    But what use case would you want this? I access ~/Library enough that keeping that unhidden makes sense, but I certainly don't want all files unhidden because that just makes everything visually unappealing. In the past I've done it to find some folders and files that an app my hidden with a preceding period, but at this point I don't deal with that kind of crap on my own machines, so it's mostly to quickly look at other people's machines to look for things that are out of place. If it's for security, It's not to going to make anything more secure.
    edited July 2018 Alex1N
Sign In or Register to comment.