X

How to save to hidden directories in OS X

Accessing a hidden folder from within an application may be tricky, but can be overcome using a simple Finder trick.

Topher Kessler MacFixIt Editor
Topher, an avid Mac user for the past 15 years, has been a contributing author to MacFixIt since the spring of 2008. One of his passions is troubleshooting Mac problems and making the best use of Macs and Apple hardware at home and in the workplace.
Topher Kessler
2 min read

While in standard uses there may be little reason to save files to a hidden directory in OS X, there are sometimes cases when you might want to do this. The operating system contains numerous hidden directories, such as the Library folder in your user account, a number of system folders that contain configuration files and programs, as well as the ability to manually hide specific folders on your system which, for fun or otherwise, can be used to keep items relatively hidden.

If you would like to access a hidden folder on your system, you might find that accessing them can be a bit of a burden. One approach is to regularly unhide the folders, either by changing their finder flags or by setting the Finder itself to show hidden directories.

Another approach is to open a program under the root account, since this account has full access to the entire file system, and should therefore be able to access any directory. This can be done by opening Terminal and targeting the desired application's executable using the "sudo" command, such as the following for TextEdit:

sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit

While this might seem logical, unfortunately it will be met with the same restrictions and you will still not be able to see a hidden folder in the Finder. This approach is good for editing files that can only be accessed by root, but will not overcome the inability to see a hidden folder.

If you would instead like to keep files hidden in the Finder but still access them in a program you are using (be it run under your account or under root), then you can use a technique in the Finder to access it.

Simply choose Go To Folder from the Finder's Go menu, and then enter the path to the hidden directory in the field (note that this field supports tab-completion of file and folder names). Then press Enter to open the folder, which will show in the Finder slightly grayed out. You can drag this folder to the Open or Save dialogue box in any application, which will point that application to the contents of this folder.

From here you can open or save files, and the program will treat the folder as any other you can save files to.

Note that some applications, such as BareBones' TextWrangler, which are built for viewing and editing hidden directory contents, may have options in their Open and Save dialogue boxes that allow you to reveal hidden items. In this cases, these options will be far easier to use.



Questions? Comments? Have a fix? Post them below or !
Be sure to check us out on Twitter and the CNET Mac forums.
The MacFixIt blog can be found directly at http://www.macfixit.com