Browse > Home / Computer, How To, Science / Blog article: Installing VTK on Mac OS X -

Installing VTK on Mac OS X

September 6th, 2009 Posted in Computer, How To, Science

VTK Precompiled Universal Binaries (OS X 10.5/10.6)

VTK is a great open source 3D visualization library. (The comet program uses VTK for all its 3D rendering—examples movies here).  You can read below how to build the VTK libraries on OS X from source, but if you simply want to use them, you can download Universal Binaries of the VTK libraries for OS X here (The current version is 5.5 as of 03/12/10).  The libraries are in the file called ‘’, and you can find the source tree from which they were compiled in ‘’.

Using VTK in an XCode project

To use these for an XCode project, open the project, select Project->Edit Project Settings and under the Build tab change ‘Library Search Paths’ to include the path to the libraries, e.g., /Users/mark/VTK/lib/ and ‘Header Search Paths’ to include the path to the header files, e.g., /Users/mark/VTK/include/ (changing the user name and version as appropriate).

Building VTK as Universal Binaries on OS X

It took me a little while to get VTK compiled on OS X 10.5/10.6, so I’m posting the instructions here in case they are helpful to others trying to compile it.  VTK uses cmake, which is not very straightforward, but seems robust once you know the secret ways.  This is largely based on the vtk wiki, the instructions here and some fiddling. Note: this is using the CVS version version of VTK (currently 5.5)

First, install the Apple Developer Tools (Xcode), and Macports, then open a terminal and use Macports to install CMake:

sudo port selfupdate
sudo port install cmake

Create a directory for VTK, and download the CVS version of the software:

mkdir VTK
cd VTK
cvs -d login

enter ‘vtk’ as the password, then start the download:

cvs -d checkout VTK

Make a directory for the build and run cmake from that directory, pointing to the source you just downloaded:

mkdir VTKBuild
cd VTKBuild
cmake ../VTK

Cmake will make its config files based on the system info. These will be almost right, but we need to open CMakeCache.txt in a text editor and change the following (replace /Users/mark/VTK/VTKBuild with the path you chose above):


Make sure to change the username in that last line to match your own. If you want to make universal binaries, edit these lines including the targets you want, and set the target to the minimum OS you want to support (I use 10.5):


Then call cmake again and it will write out a makefile:

cmake ../VTK

Finally, compile and install (this takes some time):

make install

If all is well, you should have a set of compiled libraries in VTKBuild/bin and include files in VTKBuild/include/vtk-5.5 (depending on the current VTK version number).  If you built universal binaries, you can check the architectures by using lipo:

$ lipo -info libvtkRendering.a
Architectures in the fat file: libvtkRendering.a are: ppc ppc64 i386 x86_64
Tags: ,

One Response to “Installing VTK on Mac OS X”

  1. David says:

    Hi, I am trying to build vtk on osx 10.6 as per instructions above,
    but when I make vtk I get the following error: CMake Error at
    CMakeLists.txt:5 (message): VTK has moved! See for details.
    This source tree comes from the legacy CVS repository at and exists only to report
    this message. The legacy repository is no longer maintained. Old
    versions are still available by date- or tag-based checkout, but
    the new repository is preferred.
    anyone able to help??

Leave a Reply

To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
Click to hear an audio file of the anti-spam word