X

mac.column.ted: The non-Terminal users guide to not using Terminal

Mac users happily browse the Web, check their e-mail, use iTunes and iPhoto, or run Microsoft Office--all without any thought as to what may be going on behind the scenes. Which is exactly as it should be. A host of easy-to-use utilities allow you to acco

CNET staff
6 min read

Ted Landau

April 2009

As a MacFixIt reader, you are probably aware that a UNIX engine supplies the power behind Mac OS X's glittering graphical user interface. For most Mac users, however, this is completely irrelevant information. Mac users happily browse the Web, check their e-mail, use iTunes and iPhoto, or run Microsoft Office--all without any thought as to what may be going on behind the scenes. Which is exactly as it should be.

Still, there are occasions, usually either when you need to troubleshoot an issue or want to customize the user interface, where UNIX commands are often recommended as the solution. The typical way to enter these UNIX commands is via Terminal, the command-line application included in the Mac OS X Utilities folder. Of course, using Terminal requires either that you know UNIX or that you follow a "cookbook" set of instructions for a specific task. Once again, I suspect that the majority of Mac users don't fall into either of these categories. Actually, I suspect that many if not most Mac users are unaware that an application called Terminal is even on their hard drive.

In the early days of Mac OS X, a lack of UNIX expertise was a significant obstacle for aspiring power users. There was no alternative way to accomplish many of its tasks. Even today, I would not discourage any motivated user from discovering the joys of UNIX, and would certainly not go so far as to say such knowledge is without value. However, except in the rarest of cases, it is no longer a necessity. A host of easy-to-use utilities allow you to accomplish at least 90 percent of what most Mac users would otherwise need Terminal to do.

While you'll still find Terminal-based solutions posted in forums and on Web sites, don't assume that these solutions are required. In almost every case, there is a (usually easier) non-Terminal alternative. Don't believe me? See for yourself:

Find a file

While Spotlight is a useful tool for finding files on your drive, it is far from perfect. For starters, it does not search inside Mac OS X's Library folders by default. Nor will it search inside application packages or UNIX directories. When you need to search these locations, it is often advised that you fire up Terminal. But it is almost never necessary.

Use Spotlight. For starters, you can use Spotlight to search inside a Library folder. To do so, simply open a window for the desired Library folder and select Command-F. From here, select Library as the Search location in the row below the toolbar.

Locate invisible files. Spotlight can also search inside invisible folders or locate invisible files anywhere on your drive. To do so, again start with Command-F and, from the Kind > Any popup menus, select File Visibility > Visible or Invisible. [If File Visibility is not listed by default, select Other... to find it.] Now do your search.

Actually, if you instead want all the invisible files on your drive to appear in the Finder, there is an even better alternative. Use any of the dozen or so utilities that can instantly make invisible files temporarily visible. I typically launch a one-trick pony utility, such as Show & Hide. You can just as well use a multipurpose utility such as TinkerTool (go to Finder > Finder Options and enable "Show hidden and system files").

One benefit of making these invisible items visible is that you will be able to see the normally hidden UNIX folders (such as var and etc). This can be helpful for certain tips that require that you modify items in these folders. In most cases, however, there is an even simpler way to access the contents of UNIX directories: Type Command-Shift-G in the Finder. From the "Go to Folder" sheet that drops down, enter the path to the desired directory (such as /etc) and click Go. Even though the folder itself remains invisible, its contents are visible and will be listed.

Use Locator. One limitation of searching via Spotlight is that you can't easily search multiple "special" locations at once. For example, there is no way to search /System/Library and inside application packages at the same time. And, for UNIX folk wanting to do GREP searches, Spotlight has no comparable function. Still, you can overcome all of these obstacles with a GUI utility called Locator. Although not supported by the author any more, I find the program still works. Just about anything you can do with the locate command in Terminal, you can do with this utility instead, generally with less effort.

View or edit text files

Apparently, there is a logic that says that, if you want to view the contents of UNIX-related text files, such as the hostconfig file in the /etc directory, you should do so in Terminal--via commands such as more or tail. If you actually want to edit any of these files, you need a Terminal-based text editor such as nano.

Not true.

Actually, most text files can be easily opened and edited with the TextEdit application that comes with Mac OS X. Even better, get the free TextWrangler program from BareBones. With TextWrangler, you can perform tricks such as opening invisible files (using the Open Hidden command in its File menu) and saving edited files to which you do not otherwise have permission to modify - all while maintaining the file's UNIX line-break format and permissions.

TextWrangler not only does just about any editing you might otherwise want to do via a UNIX text editor, but also it does so with far greater ease, especially for tasks such as cut-and-paste. That's why, even if you are comfortable using Terminal, you might still like to shift to TextWrangler for text editing. If that describes you, select Install Command Line Tools from the TextWrangler menu. This enables the edit command in Terminal. After typing the command, enter a space and the path of the desired file; the file will immediately open in TextWrangler.

Set permissions

Have you ever been told the solution to a problem is to modify the permissions settings for some file? If so, chances are good you've been instructed to launch Terminal and use the chmod command. No need to bother with that.

In many cases, all you need is to select the file in the Finder and open its Info window (via Command-I). From here, scroll down to the Sharing & Permissions section. Unlock this section, by clicking the padlock icon and entering your admin password. You can now modify the file's owner as well as change its basic read/write permissions. You can even assign permissions for specific users, by clicking the button and making your selection.

In the rare case where you need more power than Get Info provides, you can instead use a permissions editing utility, such as the excellent FileXaminer. This utility mimics the UNIX read/write/execute permissions actions of chmod, showing you the exact equivalent command. You can even modify less common permissions settings such as Sticky Bit or Set User ID.

Edit .plist files

Probably the most common reason for recommending Terminal is to make changes to an application's Preferences (.plist) file. Such changes can unlock an assortment of otherwise hidden features for a program (see my series of articles on the subject, if you want the full scoop). In Terminal, you use the defaults command to make these changes. However, just about anything you can do via defaults; you can more easily do via any of several GUI utilities, starting with Apple's own Property List Editor (included as part of its Developer software) or the third-party PlistEdit Pro.

With these utilities, you have control over the entire contents of a preferences (.plist) file. However, if you're willing to sacrifice some flexibility, there are simpler alternatives: utilities that specifically enable/disable preselected .plist file settings. The program with the most complete set of these options is Secrets (although its System Preferences pane appears not to have been updated since 2008). Otherwise, you can turn to more general purpose utilities, such as the aforementioned TinkerTool, or utilities specific to a particular application, such as Safari 4 Modifier.

More to come...

I've only scratched the surface. In next month's column, I'll describe at least five more ways that you can avoid using Terminal.

Click here for part 2 of this tutorial

To get my latest book, Take Control of Your iPhone, click the link. To send me an e-mail, click here. You can also follow me on Twitter.