Compiling PCL and its dependencies from MacPorts and source on Mac OS X

This tutorial explains how to build the Point Cloud Library from MacPorts and source on Mac OS X platforms, and tries to guide you through the download and building of all the required dependencies.

Mac OS X logo


Before getting started download and install the following prerequisites for Mac OS X:

  • XCode (
    Appleā€™s powerful integrated development environment
  • MacPorts (
    An open-source community initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac OS X operating system.

PCL Dependencies

In order to compile every component of the PCL library we need to download and compile a series of 3rd party library dependencies. We’ll cover the building, compiling and installing of everything in the following sections:


The following libraries are Required to build PCL.

  • CMake version >= 2.8.3 (

    Cross-platform, open-source build system.


    Though not a dependency per se, the PCL community relies heavily on CMake for the libraries build process.

  • Boost version >= 1.46.1 (

    Provides free peer-reviewed portable C++ source libraries. Used for shared pointers, and threading.

  • Eigen version >= 3.0.0 (

    Unified matrix library. Used as the matrix backend for SSE optimized math.

  • FLANN version >= 1.6.8 ( Library for performing fast approximate nearest neighbor searches in high dimensional spaces. Used in kdtree for fast approximate nearest neighbors search.

  • Visualization ToolKit (VTK) version >= 5.6.1 (

    Software system for 3D computer graphics, image processing and visualization. Used in visualization for 3D point cloud rendering and visualization.


The following libraries are Optional and provide extended functionality within PCL, ie Kinect support.

  • Qhull version >= 2011.1 (
    computes the convex hull, Delaunay triangulation, Voronoi diagram, halfspace intersection about a point, furthest-site Delaunay triangulation, and furthest-site Voronoi diagram. Used for convex/concave hull decompositions in surface.
  • libusb (
    A library that gives user level applications uniform access to USB devices across many different operating systems.
  • PCL Patched OpenNI/Sensor (
    The OpenNI Framework provides the interface for physical devices and for middleware components. Used to grab point clouds from OpenNI compliant devices.

Advanced (Developers)

The following libraries are Advanced and provide additional functionality for PCL developers:

  • googletest version >= 1.6.0 (
    Google’s framework for writing C++ tests on a variety of platforms. Used to build test units.
  • Doxygen (
    A documentation system for C++, C, Java, Objective-C, Python, IDL (Corba and Microsoft flavors), Fortran, VHDL, PHP, C#, and to some extent D.
  • Sphinx (
    A tool that makes it easy to create intelligent and beautiful documentation.

Building, Compiling and Installing PCL Dependencies

By now you should have downloaded and installed the latest versions of XCode and MacPorts under the Prerequisites section. We’ll be installing most dependencies available via MacPorts and the rest will be built from source.

Install CMake

$ sudo port install cmake

Install Boost

$ sudo port install boost

Install Eigen

$ sudo port install eigen3

Install FLANN

$ sudo port install flann

Install VTK

To install via MacPorts:

$ sudo port install vtk5 +qt4_mac

To install from source download the source from

Follow the README.html for compiling on UNIX / Cygwin / Mac OSX:

$ cd VTK
$ mkdir VTK-build
$ cd VTK-build
$ ccmake ../VTK
Within the CMake configuration:

Press [c] for initial configuration

Press [t] to get into advanced mode and change the following:



VTK must be built with Cocoa support and must be installed, in order for the visualization module to be able to compile. If you do not require visualisation, you may omit this step.

Press [g] to generate the make files.

Press [q] to quit.

Then run:

$ make && make install

Install Qhull

$ sudo port install qhull

Install libusb

$ sudo port install libusb-devel +universal

Install Patched OpenNI and Sensor

Download the patched versions of OpenNI and Sensor from the PCL downloads page

Extract, build, fix permissions and install OpenNI:

$ unzip -d openni_osx
$ cd openni_osx/Redist
$ chmod -R a+r Bin Include Lib
$ chmod -R a+x Bin Lib
$ chmod a+x Include/MacOSX Include/Linux-*
$ sudo ./install

In addition the following primesense xml config found within the patched OpenNI download needs its permissions fixed and copied to the correct location to for the Kinect to work on Mac OS X:

$ chmod a+r openni_osx/Redist/Samples/Config/SamplesConfig.xml
$ sudo cp openni_osx/Redist/Samples/Config/SamplesConfig.xml /etc/primesense/

Extract, build, fix permissions and install Sensor:

$ unzip -d ps_engine_osx
$ cd ps_engine_osx/Redist
$ chmod -R a+r Bin Lib Config Install
$ chmod -R a+x Bin Lib
$ sudo ./install

Building PCL

At this point you should have everything needed installed to build PCL with almost no additional configuration.

Checkout the PCL source from the Github:

Create the build directories, configure CMake, build and install:

$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install

The customization of the build process is out of the scope of this tutorial and is covered in greater detail in the Customizing the PCL build process tutorial.

Using PCL

We finally managed to compile the Point Cloud Library (PCL) for Mac OS X. You can start using them in your project by following the Using PCL in your own project tutorial.

Advanced (Developers)

Testing (googletest)

API Documentation (Doxygen)

Install Doxygen via MacPorts:

$ sudo port install doxygen

Or install the Prebuilt binary for Mac OS X (

After installed you can build the documentation:

$ make doc

Tutorials (Sphinx)

In addition to the API documentation there is also tutorial documentation built using Sphinx. The easiest way to get this installed is using pythons easy_install:

$ easy_install -U Sphinx

The Sphinx documentation also requires the third party contrib extension sphinxcontrib-doxylink ( to reference the Doxygen built documentation.

To install from source you’ll also need Mercurial:

$ sudo port install mercurial
$ hg clone
$ cd sphinx-contrib/doxylink
$ python install

After installed you can build the tutorials:

$ make Tutorials


Sphinx can be installed via MacPorts but is a bit of a pain getting all the PYTHON_PATH’s in order