This course uses the gcc compiler and, to a lesser extent, the Unix or Linux environment, both for consistency, and to expose you to the platform used by many practitioners in computer science. MacOS X comes with the gcc compiler already installed. MacPorts, somewhat like the CygWin installer, is an application that makes it easy to download and install open-source software packages, such as CppUnit, a C++ testing framework.
The Apple Developer Connection has a very nice article on how to install MacPorts, use MacPorts to install other code, and build an XCode project using the code installed by MacPorts. You should read that article first. Our notes below show what to do to use MacPorts to install and test CppUnit.
First, make sure you have XCode installed. It's on the developer CD that came with your Macintosh. If you don't have it, you can get it from Apple. It's a very big download, so use the CD if you have it.
Next, download and run the current version of the MacPorts installer from the MacPorts website.
Installing software packages with MacPorts is very easy. We'll show how to use it to CppUnit. The same steps would work with any other package.
The default way to run MacPorts is to enter text commands in a Terminal window. There are graphical front-ends as well, but the command lines are very simple for what you'll need to do, so that's all we'll show here.
sudo port install cppunit +universal
portis the MacPorts program.
port arguments...to do all MacPorts actions.
portwith sudo, to get adminstrative access.
sudowill ask for your password.
cppunitis the name of the package you want to get. There are hundreds of packages available.
+universalmeans you want the "universal" variant of this package. Universal means the code has been compiled to run on Intel and pre-Intel Macintoshes. By default, that's what XCode wants for released software. (You can change that default but that's outside the scope of this course.)
/opt/local/liband the header files should be in
To test that CppUnit is installed and working correctly, follow these example XCode project setup instructions. These files have code that define some simple test cases. Some of these tests are supposed to fail, in order to show you what that looks like.
Comments? Contact the Prof!