Enterprise Software

Go under your Mac's hood with the OS X Terminal

Apple's Mac OS X has a powerful command-line interface that many users will never even know exists. It's not for everyone, but for techs the Terminal can be a powerful tool. If you haven't explored the command-line resources provided with OS X, here's where to begin.

Apple's Mac OS X has a powerful command-line interface that many users will never even know exists. It's not for everyone, but for techs, the Terminal can be a powerful tool. If you haven't explored the command-line resources provided with OS X, here's where to begin.

—————————————————————————————————————————————————————————-

Modern operating systems work really hard to impress us with their graphical refinements. Doing so makes good marketing sense, certainly. Eye candy pulls in those folks browsing in the retail sales aisles, and pretty screenshots grab attention online. Graphical user interfaces aren't a necessity for working with personal computers, though. Command-line interfaces are where operating systems began, and they're still a tool that power users can turn to when they need to get something done with a minimum of fuss.

Apple's Mac OS X is built on top of a Unix-based operating system called BSD, and like Unix, OS X has its own command line. Terminal, the program that launches the command-line interface on a Mac, can be found in the Utilities folder within a system's Applications directory. Upon launching Terminal, one is confronted with a white window, empty except for a command prompt.

"Why bother with a Mac's command line?" some may ask. If you're used to supporting Macs via their graphical interface, Terminal will come with a bit of a learning curve, but sometimes it's the only way to accomplish a particular task. For example, many a Mac user has been confronted with items that can't be emptied from the system's Trash by normal means. In my experience, this often results from problems with a file's ownership or permissions properties, and a quick way to clean up these files is by launching the Terminal and using sudo and rm to delete the offending items via the command line.

(For those who want to try the previous trick themselves, bear in mind that OS X has several system directories where trashed files are stored until they're deleted. To make sure you know where your culprits are stuck, find out their system path using the GUI's Get Info command.)

OS X uses common open-source command sets within Terminal. Recent builds since version 10.3 "Panther" provide the bash shell for the command line, and earlier versions use tcsh; a web search will turn up any number of references for these command shells that will work fine with Mac OS X. If you'd like more Mac-specific documentation—probably the best place to start for anyone who hasn't used a Unix-like command line before — TechRepublic has a couple of chapters available from O'Reilly's Mac OS X reference volumes:

Once you're comfortable with the basics of a Unix-like command shell as used by the Terminal, you should look into the Mac-specific command-line utilities that Apple has developed. Since Mac OS has a built-in Secure Shell server, a skilled tech can accomplish almost any maintenance or support task on a remote Mac without having to worry about being restricted to Apple's GUI tools. You can find Apple's guide to the command line for System Administrators here:

Graphical interfaces make computers more accessible for casual users, but for those in the know, the command line is where the real power lies. If you're supporting Macs, I think a familiarity with the power of the Terminal is something worth adding to your repertoire.

A word to the wise, though: it's possible that through careless use of command-line tools, one could do a lot of damage to a system. Always make backups.

Editor's Picks