To install Xcode and the X11 SDK, follow the steps below.
Always make sure to install the latest available version of Xcode for your Mac OS X release; using outdated versions of Xcode may cause port install failures. Also note that Xcode is not updated via Mac OS X's Software Update utility on OS versions prior to 10.6.
Download the latest version of Xcode if you have the currently shipping release of Mac OS X.
If you are using Mac OS X 10.6, there are two branches of Xcode which could be considered to be the latest, 3.2.x and 4.0.x. Xcode 4 costs money, but Xcode 3 is still available free of charge. There are two options for downloading it:
Xcode 3.2.2 - smaller download, but you will need to run Software Update after installing to get the latest version.
Xcode 3.2.6 and iOS SDK 4.3 - includes iOS SDK which is not needed for MacPorts.
You may also be able to install Xcode 3.2 from your Mac OS X 10.6 DVD and then run Software Update to get the latest version.
If you have an earlier release of Mac OS X, you may download the latest version of Xcode for OS X 10.5 (v3.1.4) or for 10.4 (v2.5).
Run the Xcode package installer.
Ensure that those of the following options that are available in the installer for your version of Xcode are selected:
Click to install Xcode.