How to show/hide invisible files in Mac OS X

Standard

Showing the invisible files in Mac is easy although tricky for newbies. Apple has decided to hide a lot of the system files, so that normal users dont temper with them and so yield the OS unstable or unusable at some point.

there are several ways of doing it:

  1. using Terminal
  2. or

  3. using a script
  4. or

  5. using a handy utility through Automator service

Let us see how each method works:

Using Terminal

This is the quick and simplest way if you want to enable or disable the hidden files once.

  1. Launch a terminal window from Applications->Utilities->Terminal
  2. type the following two commands to show the hidden files:

defaults write com.apple.finder AppleShowAllFiles YES
killall Finder

the first command enables the hidden files in Mac, and the second command reset the Finder application so that changes are immediately applied.

type the following two commands to hide the system files back:

defaults write com.apple.finder AppleShowAllFiles NO
killall Finder

that’s it.

Using a script

This is another easy way to enable or disable the hidden files. The advantage is you can just double click to launch the script from Finder and it will do the thing. You can use the script any time and you can possibly store it in your utilities folder too.

  1. Launch TextEdit from Applications->TextEdit
  2. go to Format and choose Make Plain Text
  3. Type the following commands
  4. #!/bin/sh
    defaults write com.apple.finder AppleShowAllFiles YES
    killall Finder
    exit;

  5. Save the file in your documents folder and make sure the extension is .command. For example save the file as EnableHiddenFiles.command
  6. saving the file as .command enables the file to be treated as an executable Terminal shell and it will automatically be associated with the Terminal application.

  7. In order to make the file executable, now launch a terminal windows and type the following command
    chmod +x EnableHiddenFiles.command

Note: If you run the script, you notice that the terminal window is still open showing the the [process completed]. In order to Close the terminal after execution, just open Terminal and go to Terminal > Preferences > Settings > Shell: > When the shell exits: -> Close if the shell exited cleanly

you can now test and launch the script by double clicking on it from where you have save it. You may also save it to your Utilities folder for easy access.

create another script to hide back the system files by creating a new script using instead
#!/bin/sh
defaults write com.apple.finder AppleShowAllFiles NO
killall Finder
exit;

Using an Automator service workflow

Automator service

Automator service


This is my favorite method in MAC OS X 10.8.3 (Mountain Lion). In this method, you can use the Automator application to build a reusable utility to enable and disable the hidden files whenever you want to.The advantage is that you can access the utility simply using a right-click (alternate click) on the finder application. So easy and nifty solution.

  1. Launch Automator from Applications
  2. Choose Service as the type, and search for Run Shell Script in the library
  3. Add the code below
    defaults write com.apple.finder AppleShowAllFiles YES
    killall Finder
  4. under Services Received selected , choose “No Input” and choose “Finder” in the menu of applications
  5. Save the file and name it something like Show System FilesNow when you go to Finder application menu, you will see a new menu item under Services for Show System Files
  6. repeat the above and change the code to
    defaults write com.apple.finder AppleShowAllFiles NO
    killall Finder

the files are saved under ~/Library/Services if you want to edit it later.

Please leave a comment if you find those tips useful…

About these ads

One thought on “How to show/hide invisible files in Mac OS X

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s