Table of Contents
- About the Author
- Tell Us What You Think!
- Part I: Introduction to Mac OS X
- Chapter 1. Mac OS X Component Architecture
- Chapter 2. Installing Mac OS X
- Chapter 3. Mac OS X Basics
- Chapter 4. The Finder: Working with Files and Applications
- Chapter 5. Running Classic Mac OS Applications
- Part II: Inside Mac OS X
- Chapter 6. Native Utilities and Applications
- Chapter 7. Internet Communications
- Chapter 8. Installing Third-Party Applications
- Part III: User-Level OS X Configuration
- Chapter 9. Network Setup
- Chapter 10. Printer and Font Management
- Chapter 11. Additional System Components
- Part IV: Introduction to BSD Applications
- Chapter 12. Introducing the BSD Subsystem
- Chapter 13. Common Unix Shell Commands: File Operations
- Part V: Advanced Command-Line Concepts
- Chapter 14. Advanced Shell Concepts and Commands
- Chapter 15. Command-Line Applications and Application Suites
- Chapter 16. Command-Line Software Installation
- Chapter 17. Troubleshooting Software Installs, and Compiling and Debugging Manually
- Chapter 18. Advanced Unix Shell Use: Configuration and Programming (Shell Scripting)
- Part VI: Server/Network Administration
- Chapter 19. X Window System Applications
- Chapter 20. Command-Line Configuration and Administration
- Chapter 21. AppleScript
- Chapter 22. Perl Scripting and SQL Connectivity
- Chapter 23. File and Resource Sharing with NetInfo
- Chapter 24. User Management and Machine Clustering
- Chapter 25. FTP Serving
- Chapter 26. Remote Access and Administration
- Chapter 27. Web Serving
- Part VII: Server Health
- Chapter 28. Web Programming
- Chapter 29. Creating a Mail Server
- Chapter 30. Accessing and Serving a Windows Network
- Chapter 31. Server Security and Advanced Network Configuration
- Chapter 32. System Maintenance
- Appendix A. Command-Line Reference
- Appendix B. Administration Reference
Running Classic Applications
The first time that you launch a Classic application, you'll notice that several interesting things happen. Things don't quite match, as you can see in Figure 5.9. The Netscape window is shown using the Classic platinum appearance, and the Apple menu is back…but the rest of the screen contains Mac OS X elements such as windows and the Dock!
Figure 5.9 Classic looks a little weird.
Visually, Classic applications (such as Netscape Communicator is seen in Figure 5.9) look just as they would under Mac OS 8 and 9. The Aqua appearance does not carry over to the windows, buttons, and other interface elements.
The Dock and process manager both recognize Classic applications. The Dock will show the older applications' icons, just as if they were native Mac OS X applications. Figure 5.10 shows the process manager (Command+Option+Escape) with several Classic applications listed.
Figure 5.10 The Force Quit process manager lists Classic applications along with native apps.
If you use the process manager to force quit a Classic application, you should follow up immediately by saving your open documents (within Classic apps) and restarting the environment. This is another area in which Classic has not benefited from the advanced features of Mac OS X. A force quit within Classic is identical to a force quit in Mac OS 8 and 9. At best, it will work and leave your Classic system usable and slightly less stable. At worst, it will immediately crash all running Classic software.
Messing Up Classic
When running Classic, you'll notice that the Mac OS X menu bar is replaced by the Mac OS 9.x menu. Using this menu, you can access all of the earlier system's control panels and associated functionality. Settings such as appearance and sound are harmless enough, but it is possible to accidentally disrupt your network connections by working with the TCP/IP and AppleTalk control panels.
Under Mac OS 8 and 9, network connections are made via four primary methods:
- Remote access dial-in connections
- AirPort wireless
In Mac OS X, there is a single connection: the Mac OS X network driver. Rather than implementing two separate network connections, the Classic environment uses a special OS X–installed driver that routes all network traffic through OS X's kernel-level network connection.
Figure 5.11 shows the TCP/IP configuration panel from Mac OS 9.x within the Classic environment. The corresponding Mac OS X connection is set to a static IP address over Ethernet.
Figure 5.11 Mac OS X provides a special OS 9.x driver to pass Classic network traffic to the new kernel.
The Classic environment relies on a special TCP/IP configuration called Classic—do not attempt to rename or remove this configuration. If these settings are modified, you will lose the capability to connect to the network from within Classic.
Usability Issues and Anomalies
Classic is largely usable without any need for knowledge of how it interacts with Mac OS X. You continue to use programs in a manner that is identical to System 9.x. There are, however, a few exceptions that might be confusing for you:
- Copy and Paste/Drag and Drop— Two of the most common means of moving data within Mac OS suffer when working between native and Classic applications. Data copied from one environment can take several seconds before it is available for pasting within another. Dragging and dropping text and images between native and Classic applications fails altogether.
- Desktop Pictures and Patterns— Mac OS X has its desktop background, but that doesn't mean Classic won't load its own. You will encounter instances when the screen does not refresh correctly and there are "holes" in the Mac OS X desktop that reveal the 9.x background image underneath. This is not a serious problem and can be ignored. If the visual defects are unbearable, you can use the 9.x Appearance control panel to set the same background image in Classic as is set in Mac OS X.
- Favorites— Although Favorites are available in the OS 9.x environment, they do not transfer between Classic and Mac OS X.
- Mac OS 9 Desktop— A Mac OS 9 Desktop folder alias is one of the default icons on the Mac OS X desktop. This alias is specific to Mac OS 9 when it is booted directly. It does not apply to the Classic environment. When using Classic, items that are saved to the Desktop will appear, as expected, in the Mac OS X desktop.
- Open/Save Dialog Boxes— Mac OS X applications are aware of the special folders and files used by the system and take care to hide them. The same cannot be said for Classic apps. The Open and Save dialog boxes clearly show the invisible items. Although it's harmless, this is probably not the best way for a new user to be introduced to Macintosh software.
- Printing— Printing services from Mac OS X are not extended to Mac OS 9.x. If you intend to print from within the Classic environment, you must configure your printer through the Chooser. Unfortunately, the only working printers are EtherTalk-based network printers. Workarounds will be discussed later in this chapter.
Users who are expecting a completely seamless work environment might be disappointed by these shortcomings, but many of them can be overcome through additional software or by working within the BSD subsystem, described in Chapter 12.
The following information should be used only if you are comfortable with potentially disrupting the functionality of your computer. Even though these tips are not expected to cause any problems with the shipping version of Mac OS X, Apple might make future changes that eliminate the usefulness of this information or introduce system errors.
For the cases of both the Desktop folder and the Favorites folder, it is possible to create unified shared folders that store the same data, no matter where you are in the operating system. As with many modifications to the base Mac OS installation, there are drawbacks to doing this, so proceed at your own risk.
To create a shared folder, you must use the Unix equivalent of the Mac OS alias command; that is, ln -s. The ln or link command creates a link between a filename and a real file on your system. For example, if you have a directory named My Data that you also want to be able to access from the folder named My Files, you could use the following command within the Terminal application (path: /Applications/Utilities):
ln -s "My Data" "My Files"
There are two ways that this can be applied within Mac OS X. You can link files from Mac OS 9.x to Mac OS X, or in the reverse direction. Unfortunately, Mac OS 9 does not understand Mac OS X links unless they are being used in the Classic environment. This provides some limitations on how complex you can be with your links.
Mac OS 9 to Mac OS X Linking
To create a desktop that is shared between Mac OS 9.x (when running directly) and Mac OS X, you can link the 9.1 Desktop folder into the Desktop folder in your home directory. Any files you store on your desktop in 9.1 will automatically be a part of the Mac OS X environment as well, and vice versa. After creating this link, you can completely do away with the Desktop (Mac OS 9) alias that is placed on your OS X desktop.
You must first make sure that your Mac OS X desktop is empty. Drag any files within the desktop to your home directory. Next, determine the path of your OS 9.x Desktop folder. If you've installed on a two-partition system, the folder will be something similar to /Volumes/Mac OS 9.x/Desktop Folder; single-partition systems will always be /Desktop Folder. A quick way to check the desktop folder's path is to use the Finder's Show Info command while the Desktop (Mac OS 9) alias is selected.
From within a terminal window, use the following commands to set up the link (replacing the appropriate portions with the path you've determined):
cd ~/ First, change to your home directory.
rmdir Desktop Next, remove the existing Mac OS X desktop. If your Desktop folder is not empty, this command will fail. To remove the Desktop folder and its contents, use rm -r Desktop instead.
ln -s <Path to your 9.1 Desktop Folder> Desktop Finally, create the link from your Mac OS 9.x Desktop folder to the Desktop folder in your home directory.
This same procedure can be used to link other folders, such as the Favorites folder, to your Mac OS X Favorites (~/Library/Favorites). Unfortunately, if multiple users are using the system, they'll all end up with the same desktop and the same Favorites folder. Obviously, this isn't the most desirable effect.
Mac OS X to Mac OS 9 Linking
To turn the tables around a bit, instead of altering the Mac OS X file system, you can change Classic's Mac OS 9.x. This requires the use of ln to link folders from Mac OS X back into your OS 9 installation each time you log in. Doing so enables such nifty tricks as creating a Favorites folder that is unique for every user on the Mac OS X system. Because Mac OS X links are recognized by System 9.x only when it is running within Classic, this technique might produce undesirable results when booting directly into Mac OS 9.x. If your only exposure to Mac OS 9 is from within Classic, this produces the most seamless link between the environments.
What we're attempting to do now is slightly more complex than creating a single link. Our example will focus on the Favorites folder. To make a link work on a per-user basis, we need to create a simple script that:
- Starts up when a user logs in
- Deletes the current link to Favorites within Classic's 9.x installation
- Establishes a new link from the current user's Favorites folder to Classic
To do this, a shell script must be created and then set to launch via the Login System Preferences panel. Shell scripts provide a means of controlling the BSD subsystem that lies beneath Mac OS X. You'll learn how to create your own shell scripts in Chapter 18.
To create linked Favorites script, you'll need to navigate your Mac OS 9.x installation (from within Mac OS X), and determine the path to the Favorites folder (it should be directly inside the Mac OS 9.x folder).
Next, open a text editor such as TextEdit (path: /Applications/TextEdit) and enter the following lines (without the line numbers):
1: #!/bin/sh 2: FAVORITES="/Volumes/Mac OS 9.x/System Folder/Favorites" 3: rm -r $FAVORITES 4: ln -s ~/Library/Favorites $FAVORITES
There are only four lines in this simple script. Line 1 provides the path to the shell that will be used to interpret the script. This essentially tells the system what application can run the little program we've written. Line 2 sets a variable to the location of the Favorites folder within Mac OS 9.x. The sample script assumes a dual volume/partition setup; you might have to adjust this path accordingly.
Line 3 removes the existing Favorites link within the Classic System folder. Finally, line 4 re-creates a new link from the current user's folder to the Classic System Folder.
Save the file anywhere you'd like with the name setfavorites.command. If you want all users to have access to the script, save it outside your home directory. Because the script does not hard-code a particular user's name, any user can use it to link her Favorites folder to Classic.
Saving the script with the filename extension .command enables Mac OS X to determine that the file isn't just another text file; rather, it is a shell script. When a .command file is double-clicked, it automatically launches the Terminal applications, which then executes the file.
If you attempt to run the file manually, the Terminal launches, but the execution will fail, as shown in Figure 5.12.
Figure 5.12 The script will fail unless execute permissions are set.
One final step is needed to turn the script you entered into a runnable program: setting execution permission. You will need to open a Terminal window manually for this step and enter the following command (using the appropriate path, of course):
chmod +x <Path to the .command file you created>
Any user who runs the command file will instantly have his OS X and OS 9.x Favorites folders linked together. We're not quite done yet. Forcing a user to run an application each time he logs in is usually possible. Creating a truly seamless environment requires that the system automatically run the script file each time a user logs in to the system. The Login System Preferences panel can automate this process for you.
Automating Scripts Using the Login Panel
To set a script (or any double-clickable application or document) to launch when you first log in to Mac OS X, open the System Preferences application and click the Login icon. Choose the Login Items tab. The panel shown in Figure 5.13 will appear.
Figure 5.13 Automate script startup using the Login System Preferences panel.
The Login Items window contains a list of applications that are automatically executed when you log in. To add to the list, use the Add button to browse the file system and choose an item. Alternatively, you can drag the file to launch from a Finder window directly into the list. Remove entries in the list by highlighting them and clicking the Remove button.
If there are multiple applications that must start, you can change the order in which they execute by dragging the lines up and down within the listing. The command files that you create should be located near the top of the list.
Finally, click the Hide check box in front of the .command script file so that it is hidden as it executes. Your system is now set up to automatically link the Favorites folders at login time.
If you find yourself in the position of having a working printer under Mac OS X, but no print solution from within Classic, there is a reasonably simple way to transfer your print jobs from Classic into OS X.
Mac OS X uses the Portable Document Format (PDF) as its display language. Without any additional software, OS X can read, create, and print PDF files. This capability can be exploited by the Mac OS 9.x Classic environment and provides a convenient and efficient way to transfer documents between the two environments.
If you're lucky enough to have a copy of Adobe Acrobat, you can use the included PDF printer software to create high-quality PDF files that are readable on Mac OS X. If your budget is limited, the standalone product PrintToPDF performs the same function at a fraction of the price ($20). You can download PrintToPDF from http://www.jwwalker.com/pages/pdf.html.
After downloading, drag the PrintToPDF icon into Mac OS 9.x's System Extensions folder. This will add a new item to the Classic Chooser. You will need to open the Chooser and select the PrintToPDF icon to activate the new driver, as shown in Figure 5.14.
Figure 5.14 PrintToPDF creates documents that Mac OS X can easily open and print.
With PrintToPDF selected in the Chooser, Classic applications will prompt you for a filename when you print from them, allowing you to save a full PDF of your print job. To finish printing, you need only launch the Mac OS X Preview application (path: /Applications/Preview), open the PDF produced by Classic, and use Print as you normally would. Chapter 10, "Printer and Font Management," covers Mac OS X printer configuration.
Over time, fixes such as these should become less necessary as the Mac OS X software library grows. If at all possible, you should strive to build a native-only computer. You'll find that application interoperability and reliability are much higher.