X

mac.column.ted: The Non-Terminal Users Guide to Not Using Terminal: Part 2

<br><b>Ted Landau</b> <br><b>May 2009</b> <p>A search of the Web reveals a wealth of information about how to use Mac OS X's Terminal application to solve problems or to enhance your system. However, as I explained in <a href="http://www.macfixit.com/ar

CNET staff
6 min read

Ted Landau
May 2009

A search of the Web reveals a wealth of information about how to use Mac OS X's Terminal application to solve problems or to enhance your system. However, as I explained in Part 1 of this series, most Mac OS X users should rarely if ever need to bother with Terminal and its UNIX commands. Why? Because there are almost always other alternatives that are easier and more user-friendly for people not familiar with UNIX.

Attempting to put my money where my mouth is, Part 1 detailed several examples of how Terminal can be avoided. I continue this theme with several additional examples in this column.

Delete files that won't delete

You drag a file to the Trash, select the Empty Trash command, and an error message pops up informing you that the item could not be deleted. Initially, there is no need to even think about using Terminal. The most common solution is to quit/unmount whatever open application, document, or disk image is preventing the deletion. Other quick solutions include holding down the Option or Shift-Option keys when trying to empty the Trash (this usually works to delete locked files) or selecting the Finder's Secure Empty Trash command.

It's when all of these quick fixes fail that advice often turns to Terminal, typically suggesting either to use the sudo rm command or to modify permissions settings via chmod or chflags (as described in this Apple article). Rather than resort to these actions, you can usually have success via any of several utilities that "force empty" the trash (often by executing the UNIX command for you). I have used both FileXaminer (which has "Force Empty Trash" and "Super Delete" commands) and Cocktail (which has similar options in Files > Locked and System > Misc).

Gain root user access

The sudo command, briefly noted above, temporarily gives you system administrator (root user) privileges, allowing you to perform actions that you would otherwise not have permission to do, even as an administrator. Typically, you can attain this same super-user status without having to launch Terminal at all.

For example, in Part 1 of this series, I described how to use TextWrangler to edit text files that you would normally be prohibited from modifying. On a few occasions, you may find that such utilities are not up to the job. What you really want is root user access in the Finder itself -- so as to have unrestricted access to every location on your drive. This can be done. Here's how:

1. Launch Directory Utility (it's in the /Applications/Utilities folder).

2. Select to "Click the lock to make changes" and enter your admin password.

3. From the Edit menu, select Enable Root User. Enter a root user password of your choice. For security reasons, it's best to use a different password from the one for your personal account.

4. Quit Directory Utility.

You only need to do this once. Afterwards, you can log in as the root user (System Administrator) just by doing the following:

1. Go to the Login Window.

2. If you have the window set to display a list of users, select the Other... option. Otherwise, proceed to the next step.

3. Enter "root" as the user name; Enter the password you assigned in Directory Utility as the password.

You're in. You now have the power to do just about anything you want, with no fear of error messages popping up saying that it is not permitted. This is also why you should be very careful here. Mac OS X normally protects you from doing anything too "dangerous" (such as deleting essential system files); this protection is gone when you log in as the root user.

Delete cache files

Cache files are typically temporary files, designed to hold data that help speed up the applications that use them. For example, cache files for Safari enable previously opened pages to reload faster. However, if a Safari cache file becomes damaged, it may prevent a page from opening at all. The solution here is to delete the cache file. To facilitate this, the Safari menu includes an "Empty Cache..." command.

Many programs besides Safari, including Mac OS X itself, use cache files. Making matters more complicated, there are several locations where these caches may be located.

As such, you may come across advice to use UNIX commands in Terminal to nuke various categories of cache files. No need to bother. Instead, use utilities such as Leopard Cache Cleaner or the aforementioned Cocktail.

With Cocktail, for example, go to Files > Caches. From here, you can choose to delete only the cache files in your User account (which is what I would recommend for starters) or include system cache files as well. Click the Options button in the Caches tab if you want more precise control over what files to clear -- thereby avoiding the deletion of files that are not a likely cause of your problem. For example, if you are unable to play movies in QuickTime Player, you might select to clear just "QuickTime component" caches. Whatever you select to delete, I recommend restarting the Mac after you're done.

Quit "hidden" and "un-quittable" processes

You are probably familiar with force quitting a frozen application. You typically do this either via the application's Dock menu or via the Force Quit item (Command-Option-Escape) in the Apple menu.

But what happens if neither of these commands succeed? Or what if you want to quit a process that does not show up in the Dock or in the Force Quit menu (such as iTunes' iTunes Helper application)? It's at times such as these that you'll often be told to turn to Terminal, to use commands such as top and kill.

If Terminal is not your thing, you can instead turn to Activity Monitor (located in /Application/Utilities). This program lists all your open processes, not just the ones you see in the Force Quit window and the Dock. To quit any listed process, simply select it and click the Quit Process button in the Toolbar. From the dialog that appears, you can select to Quit or (if needed) Force Quit. If this doesn't work, go to the View menu and select Send Signal to Process. Via this command, you can try other UNIX quit commands (such as hangup and kill), which mimic what you would otherwise need to do in Terminal.

Check your network

If your Internet connection is inexplicably slow, especially if the slowness is restricted to only a few Web sites, you will likely come across advice to launch Terminal and perform a ping or traceroute as a diagnostic. This column is not the place for a tutorial on what these commands do. My point here is that you needn't resort to Terminal to execute these commands. Instead, launch Apple's Network Utility (once again located in /Applications/Utilities). Here you'll find easy implementations of ping and traceroute, as well as several other network diagnostic functions.

Still more...

This pair of columns by no means exhausts the non-Terminal possibilities. From accessing a server via ssh or ftp, to executing UNIX maintenance scripts, to rebuilding the Launch Services database, to working with log files, to almost anything else that you are likely to confront: If you want to avoid using Terminal, "there's an app for that."

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

Resources

  • Part 1 of this series
  • Apple article
  • FileXaminer
  • Cocktail
  • TextWrangler
  • Leopard Cache Cleaner
  • Take Control of Your iPhon...
  • click here
  • Twitter
  • More from Mac Musings