Mac OS X – Show / Hide Hidden Files in Finder

I always forget how to do this because I toggle this rather sporadically so I’m adding it to the public record.

To show hidden files in Finder pop open your terminal and type the text shown in the screen grab below.

To go back to hiding files we obviously just flip the AppleShowAllFiles flag to FALSE.

*Update*
As noted in the comments its nice to have the text available for easy copy and paste into your terminal.

Show:

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

Hide:

defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder

*Update 2*

You can use this script toggle between states:

# check if hidden files are visible and store result in a variable
isVisible=”$(defaults read com.apple.finder AppleShowAllFiles)”

# toggle visibility based on variables value
if [ "$isVisible" = FALSE ]
then
defaults write com.apple.finder AppleShowAllFiles TRUE
else
defaults write com.apple.finder AppleShowAllFiles FALSE
fi

# force changes by restarting Finder
killall Finder

You can also download an Automator application which will toggle hidden file visibility here:

http://www.brooksandrus.com/downloads/show_files.zip



125 Responses to “ “Mac OS X – Show / Hide Hidden Files in Finder”

  1. James says:

    Thanks for the tip, I was trying to locate a hidden .cfg file for a particular application and I couldn’t use it anymore due to conflicting settings but that command line revealed the .cfg file so now I can manually change the settings, thanks!

  2. dan says:

    Awesome! thanks.

    Although it would have been much easier if there was a simple tick box in the finder preferences, like there is in windows explorer.

  3. [...] to quickly access my .vimrc and other dot files using Finder.  I found a couple of posts online (here and here) that described setting a property through the command line like [...]

  4. MiaulementQ says:

    This was the clearest, therefore the easiest instruction on how to get my system back to “normal”! I don’t even know why the .DS_Store files started showing up everywhere… but this really was so simple. Thanks a ton!

  5. [...] the OSInstall file in the directory path specified. The terminal commands can be found here: Mac OS X – Show / Hide Hidden Files in Finder | Brooks Andrus I should get my 10V on Monday, so I'll try using EASEUS to shrink the existing XP partition, leave [...]

  6. Raul says:

    Thanks,

    After following your instruction I was able to locate two +100Gb files generated by iMovie that filled my HardDisk [OSX Trash] and made impossible to operate with my computer.

    Now I have recovered more than 200Gb space and my system is working fine!!!

  7. Danny says:

    Just wanted to say thanks. I too always switch this on and off. Thanks for showing me how to switch it this time around!

  8. Rowan says:

    Awesome mate, cheers!

  9. Ram says:

    It was really helpful.Thanks!!!

  10. Rachel says:

    Thanks!! It helped a lot. Now my mac is back to “normal”

  11. storyofcory says:

    Thanks for posting this easy to understand tip. It is much appreciated.

  12. slaapkop says:

    oooooooh tanks i could recover my files from the ipod because of this info. WWWWWWWOOOOOEPIE all is not lost.
    thanks to on-line information sharing!!!!
    it is great.

  13. Piya says:

    Thanks!

  14. [...] forum thread here gives us some good optimism, and this blog post here tells us how to show .htaccess files on a mac (thanks for the nice hack, [...]

  15. gailo says:

    Thank you very much!!!

  16. Monzter says:

    Thanks For sharing great tutorial !!

  17. Angus says:

    I used a program to show them and now i cant get rid of it and that didnt work :)

  18. Nate says:

    Wow dude thank you so much. Its about fucking time someone can give clear understanding directions about how to do something. SERIOUSLY thank you.

  19. Dyan says:

    Thank you! I couldn’t figure out why my icons were too light in the applications folder. I also couldn’t figure out how to get rid of the .DS_Store folder that was showing up. This cleaned it all up!

  20. Ashlyn says:

    By using this I was able to transfer songs directly from my iPod to my new MacBook, rather than having to deal with the tedious task of backing up my iTunes library to CDs or transferring songs via a jump drive. Thanks for the helpful info!

  21. Athoob says:

    Thank you! That helped a lot!

  22. carl says:

    you can use a keyboard shortcut which can be setup in System Preferences > keyboard

  23. [...] was turning my entire home directory into a git repository. Don’t do that (to undo this show the hidden files in the finder and delete the .git directory). After recovering from that, I started out with a simple project and [...]

  24. Bolha says:

    Congratulations for your tip. That’s simple command but help us a lot.

  25. Mick says:

    Hi,

    Firstly – as everyone else says, thanks!

    One comment – for me I had the change the script to play around with the quotes to make the if condition work correctly (OSX 10.5):

    # check if hidden files are visible and store result in a variable
    isVisible=$(defaults read com.apple.finder AppleShowAllFiles)

    # toggle visibility based on variables value
    if [ "$isVisible" = "FALSE" ]
    then
    defaults write com.apple.finder AppleShowAllFiles TRUE
    else
    defaults write com.apple.finder AppleShowAllFiles FALSE
    fi

    # force changes by restarting Finder
    killall Finder

  26. Rajeev Goyal says:

    thank you very much. you don’t know what kind of help you did.. . if you not give me that code i lost some important document file.

  27. nova media says:

    If you want to hide some files on your Mac from curious eyes, then there is a solution available. It is called UberMask. It allows to hide/show files with a single keystroke. Available for test here: http://www.novamedia.de/en/mac-ubermask.html

  28. Guffu says:

    Hi,

    Very useful information :)

    Thanks

  29. T.J. Powell says:

    Very useful, thanks!

  30. you should add a Facebook Like button to this page.
    thx for the help.

  31. Michael James says:

    I need this all the time! Never can remember it. It is useful in finding files when people have installed spyware on your Mac. Can’t believe this is not just a simple on off switch, but thanks to you, it almost is now. Thanks again!

  32. vlado says:

    Hey – many thanks this was really useful. I can;t believe that apple didn’t include this setting thought the UI

  33. phpdev says:

    Thanks! was very useful.

  34. Michael Giroux says:

    Setting com.apple.finder AppleShowAllFiles enables/disables the feature for all Finder views. I generally prefer the FALSE setting, but I have a few directories that I would like to view in Finder regardless of the setting. For this, I create symbolic links.

    1. open Terminal
    2. cd ~
    3. ln -s .bash_profile BASH_PROFILE

    Now I have a symbolic link to my .bash_profile that is visible in Finder, allowing me to select the file and edit or view.

  35. Gavin says:

    Thanks, worked for me.

  36. Jamboni says:

    Thanks, but I copied and pasted the FALSE command and the hidden files are still visible? I restarted (not a cold boot) but still there. Any reason why? And how do I use the automator program to hide or unhide files? I thought it would be a simple program with a tick box.

  37. Awesome! Thanks for the automator tool. Very handy.

  38. Sinan E. says:

    Awesome! I was looking for this. Thanks a lot.

  39. Jim K says:

    here’s a simple script that toggles:

    if [ `defaults read com.apple.finder AppleShowAllFiles` == "TRUE" ]; then
    echo “AllFiles = TRUE”
    defaults write com.apple.finder AppleShowAllFiles FALSE
    killall Finder
    else
    echo “ALLFiles = FALSE”
    defaults write com.apple.finder AppleShowAllFiles TRUE
    killall Finder
    fi

  40. loap boy wannabe says:

    Thank you for the useful tip!

    Just a question:

    I have a file (“config.txt”) that I want not to show on Desktop (but I need it to be on /path/to/desktop).
    Have you some ideas to tell application Finder to hide it?
    I’ve tried to change its “displayed name” property via applescript dot-prefixing it (keeping the same “name” property), but unsuccessfully!

    Thank you again :-)

    L.

  41. Bijan says:

    Thanks for the info. I had to use Mick’s solution to get the script working correctly.

  42. David says:

    Thank you :D !!!

  43. Wee says:

    This worked like a charm, thank you for sharing! :)

  44. Ruth says:

    Thanks! Completely ignorant of the real workings of my computer, I didn’t even know how to access the terminal, so the directions and easy paste were fabulous. It’s a relief not to have my finder cluttered up with extra files, now I can finally find my stuff!

  45. Alex Cormak says:

    For Mac OS X an later: Find the hidden and system files on Mac OS X with Funter.
    Funter is a freeware Mac utility that can show and hide hidden and system files in Mac OS X, including the user’s Library directory defaults to hiding on Mac OS X 10.7.
    You can download it here:
    http://nektony.com/funter

  46. Steve says:

    What a great post! I have no clue how you were able to write this post..it’d take me long hours. Well worth it though, I’d assume. Have you considered selling banners on your website?

Leave a Reply