Setting up OS X as a Scientific Programming Environment

Modified Sept 2005

View this page in Romanian* | German | Russian | Slovakian translation created by Sciologness Team

There's already a lot of OS X stuff on the web. This page is simply a cookbook of how I used those resources to put together my system. What follows is intended to be step-by-step instructions for new users to set up their OS X Mac to work in a Unix environment. As such, it is not for everyone. I also don't intend to be comprehensive in listing all the resources that are dealt with elsewere, but do point to links where relevant.

I have not updated for each OS X release, but most things here are generic to any release since 10.2

For current HPC resources for OS X, see


OS X puts all the standard commercial software tools (Word, Illustrator, Matlab) and a unix programming environment seamlessly into a single box. This poses many advantages to scientific programming relative to other desktop systems based on Windows, Linux, or Unix. While many unix and linux packages exist for document preparation, there are many reasons one might want to have access to the standard commercial tools that run only on Windows and Macintosh computers (eg, from Microsoft and Adobe). In the past, however, integrating these computers into the primary computing system has been awkward.

OS X's unix core allows nfs mounts, X windows, and most of the common Unix/Linux software tools can be run on the Mac so the Mac can be just another Unix computer. Fortran or c code can be directly shared between the mac and other platforms. So, one needs no longer to decide between having a unix system or a office system on one's desk; OS X does both.

Apple has a page on Unix development, which is a good place to start.

As shipped, OS X is setup for the non-technical traditional Mac user, not like a unix box. System administration is also not exactly the same as a unix box. So, a few extra steps need to be made to get it to all work.


Here are the things I needed to do to make my Powerbook function for me using open-source tools. There may be better ways around, but without much documentation, this is what I needed to do. (Wherever I give command-line instructions (ie within the shell by running Terminal), the % sign is the prompt for a normal user. The sudo command gives you administrator privileges and can only be run by someone in the admin group.)

  1. Set uid to match uid on existing unix network

  2. Set up nfs mounts to existing unix network

  3. Install X windows.

    Apple supplies an X11 emulating application, but it is not part of the standard installation. If installing from CDs, choose a custom installation and you will be given the option for X11. For new computers, an X11 installer is probably somewhere on the hard drive.

    You can also run Xfree86 from the fink project (see below).

  4. Install fortran and c compilers

  5. Install fink or MacPorts if desired in order make the software installs easier. fink is a package management system taken from GNU Debian Linux. MacPorts is a similar tool taken from BSD. In my experience, Fink is a bit more user friendly (when used for binary installs and the FinkCommander GUI) but MacPorts is more reliable. MacPorts now has a GUI also, Porticus, which requires OS X 10.4.
  6. Dealing with binary data

    The Mac uses a different binary format from Intel, AMD, and Alpha systems. The G4 uses so-called "big endian" byte order, as do most other Unix platforms. x86 (Intel, AMD) and Alpha (Dec/Compaq/HP) use "little endian". This can cause problems with sharing binary data among platforms. The best solution is to use a platform-independent self-describing format such as netCDF or HDF or even gzipped ascii.

    NetCDF is available for OS X from the above link or from fink These OS X ports only support the fortran-77 interface via g77. If you use a commercial fortran-95 compiler, such as NAGware, compile yourself according to these instructions in order to get the f90 interface.

    HDF is also available for OS X from HDF web site linked above or fink.

    For dealing with raw binary, read this article.

  7. Optimized math libraries.

    If you do any matrix operations on a G4/G5, you'll want to use LAPACK and BLAS libraries that take advantage of the vector processor.

    Macs are now included in the Automatically Tuned Linear Algebra Software (ATLAS) package. There is even a precompiled G4 library here. ATLAS contains a full tuned BLAS and a partial LAPACK.

    Since OS X 10.2, Apple includes optimized ATLAS/Lapack libraries in the vecLib framework.

    Both NAG f95 and g77 accept the -framework veclib flag to link to veclib. Eg:

    % f95 -o prog prog.f90 -framework veclib

    Absoft has directions here.

  8. Install other tools as needed. Complete lists exist elesewhere on the web, such as:

    Here's some specific stuff I like:

  9. Set up printers. You can add networked lpr printers hanging off unix boxes using Print Center if the printers don't support Appletalk. If PrintCenter crashes, then read fixes for Print Center.

Software for Atmospheric and Ocean Science

Many of the popular tools used by atmospheric and ocean scientists for data analysis and visualization are available on OS X. These include:

Other Links