Underneath its slick interface, OS X has a number of hidden configuration files that contain the settings for default and standard behaviors. While in most cases these files being hidden is good for system stability and security, sometimes you may need to access one for troubleshooting purposes or to apply small customizations to the system.
Often these files can be accessed with simple one-line Terminal commands, as is commonly seen with the "defaults" command for editing program or service property lists; however, at other times you might need to make more extensive edits to a settings file. When doing this you will run into two hurdles, the first of which is revealing the hidden files and the second of which is being able to edit them successfully without permissions errors.
Overcoming the first can be done by revealing hidden items in the Finder, or using the Finder's "Go to Folder" option (in the "Go" menu) to target a file in a hidden system directory; however, while these options can be used to show some hidden files, they do not show all of them and do not give you any permissions to edit them.
Managing the second hurdle can be done by getting information on a file and changing its permissions settings, but this is not recommended as small permissions oversights can result in the file not being properly accessible and resulting in more problems.
A more preferred method of accessing these files is to use a text editor that can support authentication to edit system files. Since Terminal commands can be promoted to run in administrative modes using the "sudo" command, often terminal-based text editors like nano, emacs, and vi are used for editing system files; however, these can be frustrating to use, especially if you wish to edit multiple files and manage large amounts of content in them.
To tackle all of these options, the best option to use is a GUI-based text editor that supports authentication such as the free TextWrangler program from Barebones software; however, being a third-party utility means an OS X system may not have it installed and if Internet access is limited then it and others like it may be difficult to acquire.
Therefore, if you need to edit system files, an alternative to TextWrangler is to use Apple's included TextEdit program. While when launched by default within a user account the program will not be able to view or edit hidden system files, as with any OS X application you can launch it and give it administrator privileges from the OS X Terminal that should allow it to view and edit system files.
Each OS X application is actually a package that includes the program's executable binary file along with other resources the program uses to run and interface with various OS X services. Since the binary itself is an executable file, you can target and launch it from the Terminal as you would any Terminal-based utility, and use the "sudo" command to give it root or administrative privileges. For TextEdit, entering the following command in the OS X Terminal will do this:
When this command is executed, after supplying your password a new instance of the TextEdit program will launch and appear in your Dock (even next to an existing TextEdit program that you may have running). This new instance will be in administrative mode, and you can use it to browse hidden files and open them for editing. Press Command-O or choose "Open" from the File menu, and you will be in the system's root user directory which you can use to access many hidden configuration files and folders, but you can also press Shift-Command-G to bring up the "Go to Folder" field and access other hidden folders if needed.
Note that while you do this, you should not close the Terminal window that you used to run the command for launching TextEdit. This window contains an execution shell in which TextEdit is running, and closing the window will quit the shell and TextEdit along with it. The shell also serves as a console for the executed program's output, so you may see some errors and warnings be listed in it, but you can ignore these.
When you have finished editing your files, you can quit the new TextEdit instance and you should see the Terminal shell drop back to the command prompt, after which you can also quit the Terminal if it is no longer needed.