Mac OS X Tiger/Advanced Concepts

The Command Line

edit

A more advanced way of accessing the command line is if you have an application like Apple's X11 or XDarwin installed. These allow you to use a range of Unix shells (including bash, csh, ksh, zsh, and tcsh), assuming you have such shells installed on your system.

There are two ways to bypass Apple's Aqua altogether and load Darwin with a Command Line Interface. You can enter a console on a per session basis by entering your username as ">console" (without quotes). (If you have an automated logon, or a selection of user names instead of an area to type the username you can use "System Preferances" and under "Accounts" you can select login options and change "Display login window as" to "Name and Password." If the Mac is booted up and showing you a list of users, you can switch it to the field-based login by pressing option-return. You may need to first move the selection by pressing any key to highlight one of the listed users.) [Note that 'Enable Firewall Logging' must be turned off in Sharing Preferences or this method will not work.]

The second method will drop you in the console each time you start up. To do this open a terminal and type:
"sudo nano /etc/ttys"
You should see something like this (the #s mark the start of a comment):

#
#       @(#)ttys        5.2 (Berkeley) 6/10/93
#
# name  getty                           type    status          comments
#
# If the console is marked insecure, single-user requires
# the root password.
#console        "/usr/libexec/getty std.9600"   vt100   on secure
console "/System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow"

Notice the two lines that start with the word "console"? The first one is commented out, which means that the second is used. The second loads the LoginWindow. To bypass LoginWindow, comment out its line by preceding it with a # mark. The nano editor does not wrap the line, so be careful that during your changes parts of the LoginWindow line don't get pushed down to the next line. If they do, use backspace to move them back, being careful to maintain white space.

Now uncomment the first console line. You've now switched which of the two lines is commented out. Save your changes by pressing Ctrl+O, then Enter, then Ctrl+X. Reboot your system and you should now see your system's complete boot process and then be presented with a standard BSD-style login.

You can swap the two comments round again, if you decide you don't want to boot into the console. When in the console and you decide you want a minimal GUI, you can install X11, and type:
"sudo /usr/X11R6/bin/startx"
to start the X GUI server.

By typing the following:
sudo /usr/sbin/nvram boot-args="-v"
you can stop the graphical loader, and get a chance to see what apple does when booting. You can get this same reaction by pressing Command-v shortly after the startup chime and holding it down until you see plain text appear in the upper-left or the screen.

Outside of Mac OS X, most UNIX applications sporting a graphical interface rely on X11. X11 refers to version 11 of the X Window System protocol. Versions of Mac OS X since 10.3 (Panther) have shipped with Apple's implementation of X11, based heavily on the XFree86 Project. In addition to the actual implementation of the X11 protocol, Apple's X11 distribution includes a window manager (very loosely analogous to a theme or skin in modern graphical interfaces) that makes windows created by most X11 applications appear as standard Mac OS X Aqua windows. Quartz-wm, as it is called, also allows X11 windows to be minimized to the Mac OS X dock.

In addition, Apple's X11 is capable of running both in full screen, or rootless mode. In full screen mode, as its name implies, X11 takes control of the user's entire screen. It is possible to switch back and forth between the standard Mac OS X desktop and X11 on-the-fly, but this is a wholesale switch, and repeating it frequently quickly becomes cumbersome. To alleviate this, rootless mode is provided. Instead of taking control of a user's entire screen area, rootless mode allows X11 and Mac OS X applications to run side by side.

To start X11 in fullscreen mode, call startx from the terminal as: startx -- -fullscreen

To start X11 in rootless mode (default), call startx as startx -- -rootless

Apple's implementation of X11 is designed to allow UNIX and Linux applications to be more easily ported to Mac OS X. It is a fairly standard X11 distribution, and as such is still configured primarily through configuration files stored throughout the system. Setting up a customized X11 environment is not easily done by users who have never before used the X Window System, and most users may never realise the need for, nor use Mac OS X's X11 environment.