Chapter 7. Configuring Your Unix Environment


As a Mac user you are accustomed to configuring your Mac with various graphical user interface (GUI) tools. For example, you configure the Finder using the Finder > Preferences window, and you configure the default audio output device using the Sound pane in System Preferences. But how do you configure Unix programs such as your shell? This chapter shows you the basics of using the command line to configure Unix command-line programs (like your shell and the vi editor), and also shows you how you can use the command line to configure virtually any Mac OS X application, including the Finder.

Unix programs that can be configured by a user get their configuration from configuration files and/or from variables such as environment variables . Configuration files are usually read by Unix programs only when they start up. These configuration files contain settings and commands that determine how the programs will behavefor instance, the files can modify the list of places your shell looks for the commands you enter (that list is called your PATH ).

In addition to traditional Unix configuration files, Mac OS X also uses a system of storing default settings (called the defaults system ) that is inherited from NextStep. The Mac OS X defaults system allows using the Unix command line to control the defaults for Aqua applications, such as the Finder, Microsoft Word, and Safari, as well as the deep internals of the Mac OS X operating system itself.

Examples of configuring your Unix environment include

  • Customizing your shell prompt so that it displays information you want to see

  • Creating shortcuts for commonly used command/option combinations

  • Changing the defaults for the Finder so that it displays all files, including ones normally hidden (such as the /usr directory)

  • Making it easier to use additional software you install; for example, if you add /Developer/Tools to your PATH , then you can use the commands in the /Developer/Tools directory without typing their full pathnames

  • Configuring specific programs such as vi to turn on various options whenever you use them, much the same way that traditional Mac programs often have a preferences window

Examples of using the Unix command line to configure an Aqua application include

  • Configuring the Finder to show hidden files, such as /usr

  • Configuring the Terminal application so that focus automatically switches to whichever window your mouse is in ("focus follows mouse")

The first program to configure is your shell, since your shell is the primary program you use to interact with Unix. We will also show you how to configure the vi editor by editing a configuration file it uses (see Chapter 6, "Editing and Printing Files," to learn how to use vi ).

It should come as no surprise by now that you configure your shell by editing text files.

Am I Configuring the Terminal Application or My Shell?

There's an important distinction to understand here.

The Terminal application you are using to access the command line in Mac OS X is not the same as your shell.

Terminal is a regular Mac OS X graphical application, like your Web browser or word processor. When you open a new window in Terminal, the application runs the appropriate Unix shell (determined by the Terminal application's preferences). Terminal is the program that is handling the screen display and keyboard input for the shell. When you type something in Terminal, the Terminal application passes that to the shell, and when the shell produces output, Terminal draws it on your screen.

The subtle point here is that there are actually other ways besides Terminal in which you can use your shell. One example: You can connect to your Mac using the command line over a network from another machine, which we'll cover in Chapter 10, "Connecting over the Internet" So when we tell you in this chapter that a change you make will take effect "in the next Terminal window you open," that is really a shorthand way of saying that the change will take effect in the next instance of your shell that you run, and that the easiest way to see it is to open a new Terminal window.




Unix for Mac OS X 10. 4 Tiger. Visual QuickPro Guide
Unix for Mac OS X 10.4 Tiger: Visual QuickPro Guide (2nd Edition)
ISBN: 0321246683
EAN: 2147483647
Year: 2004
Pages: 161
Authors: Matisse Enzer

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net