By default, Mac OS X 's Finder keeps system files - which generally start with a dot, like.bashprofile - out of your sight. But that makes editing one of these files extremely difficult if you.
This question is very similar to Is it possible to always show hidden/dotfiles in Open/Save dialogs?. How to show hidden files and folders in finder? is also related. However, I don't want to always show them, and that's what defaults write ... AppleShowAllFiles ...
does.
Rather, I want to switch it on when needed. I'm trying to open .bash_profile
, so I need it now:
Linux and Gnome allow us to CTRL+H to toggle between showing and hiding hidden files. But Gnome hotkeys don't work on OS X (which is expected).
For completeness, .bash_profile
does exist in the home directory:
A related question... As can be seen above, typing the filename in Finder (or is it Spotlight) search did not work. I tried to right click to get a context menu in the File Open dialog in hopes of checking a box like 'show all files'. And I tried the View menu looking for a 'show all files' with the File Open dialog open.
Why is this hidden away somewhere? What purpose does it serve to not allow a user to easily open a file?
3 Answers
⌘ CMD+⇧ SHIFT+. reveals hidden files in Finder and Open/Save dialogs.
If you are using an AZERTY keyboard, you'll need to press fn too, so ⇧ SHIFT is taken into consideration as you already need it to make the ..
You can also press ⌘ CMD+⇧ SHIFT+G and type the path to the hidden folder, just like in Terminal (⇥ TAB autocompletion also works).
Editing hidden files can be dangerous if you don't know what you're doing.
Mateusz SzlosekMateusz SzlosekMateusz Szlosek covered the first part. Below is how I have handled the second part for my own use.
In my haste to post my answer, I did not realize the second part has already has been answered. See How to set ⌘ + H to enable show hidden files. What I offer below differs by a dialog informing you of the current status.
I created a service using the Automator application. When I want to toggle the viewing of hidden files, I select 'Toggle Hidden Files' from the Finder services submenu as shown below. (Hint: Click image for a better view.)
This will cause either pop shown below to appear.
The steps to create the service are give below.
- Open the Automator, select a new document of type Service.
- Drag the action 'Run Shell Script' to the workflow pane.
Edit the contains to appear as shown below. (Hint: Click image for a better view.)
The text for the script is repeated below.
- Save (or move) the
Toggle Hidden Files.workflow
file to the~/Library/Services
folder. - You may need to relaunch the Finder application in order for theservice to appear on a menu.
Update 1
Building off of Mateusz Szlosek's answer, I see the keyboard shortcut ⌘ CMD+⇧ SHIFT+. could be added for my service. Go to System Preferences and click on the Keyboard icon. Select 'Services' then 'Toggle Hidden Files' under the 'General' heading. Replace 'none' with the ⌘ CMD+⇧ SHIFT+. keyboard short cut.
DISCLAIMER/WARNING
Hidden files are hidden for a reason usually. Use the script below only if you're reasonably sure you know what you're doing. In other words: If you break your system by randomly deleting hidden files, it's your own fault.
Here's the script I use to toggle show/don't show hidden files inside Finder.
(The OSX native shortcut to toggle hidden files in Open/Save dialogues was mentioned by Mateusz Szlosek above already)
The difference between my script and others I've seen so far:
Mac Os Finder Show Hidden Files In Flash Drive
Most scripts don't do anything else after killing Finder. Usually, this means you have to navigate back to the folder you were in originally, since the automatic Finder relaunch doesn't reliably open your last active folder.
The script below instead reopens, and focuses on, your last active folder, i.e. the folder you were in when using the toggle, but now showing (or not showing) hidden files.
Macos Show Hidden Files Shortcut
I assigned a shortcut to it (cmd+shift+.) and find working with hidden files in Finder a lot more convenient now.
Credit to Tetsujin who posted a script on this site a while ago that I adapted to add the 'reopen last folder' functionality.
To use the script: Open a new workflow in Automator, drag in 'Run AppleScript', copy&paste the code above, and save inside your services folder (usually, ~/Library/Services/, afaik).
Attaching a shortcut to execute a script should be covered somewhere else on this site. I limited the scope of my shortcut to Finder alone.
Style remark:
I have to resort to a bit of an ugly hack, using 'sleep' after killing Finder, before manually opening the original folder.
If I don't force this delay, there's a chance OSX relaunched Finder already and opened a folder (not necessarily the last active one, in my experience). Together with my own 'open' command, this can lead to the nasty effect of two (unkillable, even) Finder processes running, and Finder not working anymore at all. If this happens, logging out and back in again fixes it, but it's a waste of time obviously, so I use 'sleep'.
A sleep value of 0.5s works for me, but to be on the safe side, you can slightly increase it (adding a more noticeable delay to the process then).
If someone knows of a way to either suppress the Finder relaunch and unreliable opening of some window after sending the killall signal -- or some other way to get rid of the 'sleep' hack -- I'd be happy to hear it!
Bert ZangleBert ZangleYou must log in to answer this question.
Mac Show Hidden Files In Finder
protected by Community♦Jul 25 '16 at 16:09
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Hi Apple-lovers and Apple-users!
Mac Os Finder Show Hidden Files Windows 10
I haven't found a solution, how to show hidden files in Finder since the update to OS X 10.9.. I know how to show them in the Terminal but I want to see them in the Finder too.
I know the Terminal-commands for showing hidden files in OS X 10.8. ('defaults write com.apple.finder AppleShowAllFiles TRUE&&killall Finder') but this doesn't work anymore.
Mac Os Finder Show Hidden Files Mac
So if somebody has figured it out yet - please help me! 🙂
Yours,
oh_its_a_me
MacBook Pro, OS X Mavericks (10.9)
Mac Os X High Sierra Finder Show Hidden Files
Posted on