Chapter 8. Compiling Source Code

The Xcode Tools that ship with Panther provide a development environment for building applications with Cocoa, Carbon, Java, and even AppleScript. Xcode Tools include utilities that should be familiar to any Unix developer who works with command-line compilers. For details about obtaining these tools, see Xcode Tools in the Preface. Xcode Tools includes all sorts of other goodies , including an advanced Integrated Development Environment (IDE), but coverage of those tools is beyond the scope and intent of this book. To learn more about the Xcode Tools, you can see /Developer/Documentation/DeveloperTools/Tools.html .

The C compiler that comes with Xcode is based on the Free Software Foundation's GNU Compiler Collection, or GCC. Apple has added an Objective-C compiler, as well as various modifications to deal with the Darwin operating system. The development environment in Mac OS X includes:


This is an English-like language used to script applications and the operating system. AppleScript is installed as part of the Mac OS X operating system and does not require Xcode. Instead, to write AppleScripts, use the Script Editor ( /Applications/AppleScript ).

AppleScript Studio

This is a high-level development environment based on AppleScript that allows you to build GUI applications by hooking AppleScript into the Cocoa frameworks. If you plan to build AppleScript Studio applications, you will need to use the Xcode Tools instead of the Script Editor.


These compilers are based on GCC and provide support for C, C++, Objective-C, Objective-C++, and assembly. Apple's enhancements to GCC for Panther include support for the G5 (also known as the PowerPC 970) and 64-bit arithmetic, as well as the ability to generate optimized code to run on G5, G4, and G3 systems.

Compiler Tools

These include the Mac OS X Mach-O GNU-based assemblers, Mach-O static link editor, Mach-O dynamic link editor, and Mach-O object file tools, such as nm and otool .


Extensive documentation for Xcode is available in both HTML and PDF formats in the /Developer/Documentation directory. These documents are also available online from the Apple Developer Connection (ADC) web site (

After installing Xcode, you can access the local documentation for GCC at /Developer/Documentation/DeveloperTools/gcc-3.3/gcc/index.html .


The Apple debugger is based on GNU gdb .

Miscellaneous Tools

These include traditional development tools, such as make (both GNU, which is the default, and BSD) and GNU libtool , graphical and command-line performance tools, Xcode for WebObjects, parsing tools (such as lex , flex , yacc , and bison ), standard Unix source code management tools (such as CVS and RCS ), and an extensive set of Java development tools. There's also a frontend to GCC, distcc , which uses Rendezvous to distribute builds of C, C++, Objective-C, or Objective-C++ code across computers on a network.


Formerly known as Project Builder, Xcode is an IDE for Mac OS X that supports Cocoa and Carbon programming with C, C++, Objective-C, and Java.

Interface Builder

This is a graphical user interface (GUI) editor for Cocoa and Carbon applications.

We do not address the complete Mac OS X development suite in this chapter. Instead, we focus on the command-line development tools and how they differ from the implementations on other Unix platforms.

Java programmers will find that the Mac OS X command-line Java tools (see Section C.4 in Appendix C) behave as they do under Unix and Linux. Another resource for Java developers is Mac OS X for Java Geeks (O'Reilly).

Perl programmers coming from previous Macintosh systems will find that Mac OS X does not use MacPerl (, but instead uses the standard Unix build of the core Perl distribution ( For additional information on using Perl under Mac OS X, see Chapter 10.

Mac OS X Panther for Unix Geeks
Mac OS X Panther for Unix Geeks
ISBN: 0596006071
EAN: 2147483647
Year: 2003
Pages: 212 © 2008-2017.
If you may any questions please contact us: