This website uses browsing/session and functional cookies to ensure you get the best experience. Learn More


From Wiki for iCub and Friends
Jump to: navigation, search

Installation of YARP and iCub software on Mac OS X is straightforward, using the Homebrew package manager.

Latest update and testing: 1/12/2014 - using OS X 10.10.1


Installing Xcode

To compile anything on OS X (including YARP), you'll need to have XCode ( installed. This can be done through the App Store.

Once installed, you need to install Command Line Tools. To do this, open XCode, go to XCode->Preferences->Downloads and install Command Line Tools. You can now install Homebrew.

Installing X11

In OS X 10.8 Mountain Lion and later, X11 is not provided anymore. You need to install XQuartz, from In earlier version of OS X, this is not stricly necessary, but recommended as XQuartz is more robust and updated that the system-provided X11.

Installing Homebrew

Installing homebrew ( is very simple, just follow the official installation steps.

After the installation, you can run the following command to check if your setup is good :

  brew doctor

If you had Homebrew already installed on your system, update and upgrade :

  brew update
  brew upgrade

Installing Yarp

Full Homebrew setup

This option is recommended for standard users. If homebrew installation was successful, then installing YARP (with all dependencies) is just a matter of executing:

 brew tap homebrew/x11
 brew install yarp

If you need the latest development version of YARP instead of the provided release, then use:

 brew install --force --HEAD yarp

If these installation were successful you can directly check your yarp installation. If any problem arise you can't solve, feel free to contact the RobotCub mailing list (<>).

Alternative : Only installing Yarp dependencies using Homebrew

If you want to install YARP yourself from source, you can install YARP depedencies for homebrew with the following command :

brew install `brew deps --1 yarp | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/ /g'`

For compiling the Qt interfaces, you will need:

brew install qt5

If you want to compile YARP with the YarpBuilder option, you will also need:

brew install goocanvas

Before installing YARP, follow the next section, "Setting up pkg-config". You can then follow the Linux YARP compile instructions.

Setting up pkg-config

In order to install YARP (from source) or iCub correctly, the following command needs to run without problems :

pkg-config --cflags gtk+-2.0

This should not be yet the case. You need to modify your PKG_CONFIG_PATH, since it does not yet include files such as freetype2.pc.

In OS X 10.8 (Mountain Lion) and later, run this in a terminal:

echo "export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig/:$PKG_CONFIG_PATH" >> ~/.bash_profile
source ~/.bash_profile

For OS X 10.7 and older:

If you installed XQuartz, run this in a terminal :

echo "export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig/:$PKG_CONFIG_PATH" >> ~/.bash_profile
source ~/.bash_profile

Else, run this :

echo "export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig/:$PKG_CONFIG_PATH" >> ~/.bash_profile
source ~/.bash_profile

Then check again if the command run properly.

pkg-config --cflags gtk+-2.0

This should produce something of the sort :

-D_REENTRANT -I/usr/X11/include/cairo -I/usr/X11/include/pixman-1 -I/usr/X11/include -I/usr/X11/include/freetype2 
-I/usr/X11/include/libpng15 -I/usr/local/Cellar/gtk+/2.24.11/include/gtk-2.0 -I/usr/local/Cellar/gtk+/2.24.11/lib/gtk-2.0/include 
-I/usr/local/Cellar/atk/2.4.0/include/atk-1.0 -I/usr/local/Cellar/gdk-pixbuf/2.26.1/include/gdk-pixbuf-2.0 
-I/usr/local/Cellar/pango/1.30.1/include/pango-1.0 -I/usr/local/Cellar/glib/2.32.4/include/glib-2.0 
-I/usr/local/Cellar/glib/2.32.4/lib/glib-2.0/include -I/usr/local/Cellar/gettext/ 

If this is not the case (and it throws something about freetype2.pc or cairo.pc missing), it may be because you did not setup your PKG_CONFIG_PATH correctly.

Installing iCub

At the moment of writing this manual there is not yet an homebrew installation for the iCub repository. Nevertheless installation is simple since all dependencies can be installed with homebrew.

Installing iCub dependencies with homebrew

First, install the iCub dependencies with homebrew.

brew install sdl sdl_gfx sdl_image gfortran

Please note that gfortran is included in the gcc package in newer versions of homebrew.


Please note that installing ode with homebrew might result in a single-precision build, whereas you might prefer a double precision build. In order to enable a double precision build, run :

brew install ode --enable-double-precision


OpenCV has been moved to homebrew/science. In order to install it please run the following command: (Thanks to Konstantinos Theofilis for noting this)

brew tap homebrew/science
brew install opencv

Post-install fixes

If you want to compile any projects that include OpenCV libraries, you should create an empty directory:

mkdir -p /usr/local/share/OpenCV/3rdparty

Also, to compile IPOPT-related modules, the following symbolic links have to be created (assuming your current gfortran version is 4.8.1):

ln -s /usr/local/Cellar/gfortran/4.8.1/gfortran/lib/libgfortran.a /usr/local/lib/libgfortran.a
ln -s /usr/local/Cellar/gfortran/4.8.1/gfortran/lib/libgcc_ext.10.5.dylib /usr/local/lib/libgcc_ext.10.5.dylib
ln -s /usr/local/Cellar/gfortran/4.8.1/gfortran/lib/libquadmath.a /usr/local/lib/libquadmath.a

Installing Ipopt

These instructions were tested on OS X Lion, Mountain Lion and Maverick, and adapted from Installing IPOPT.

HSL MA27 and MC19 routines

Ipopt is available from homebrew, but we need finer control on the configuration of the installation. We install it manually. This assumes you want to use the iKin (cartesian interface) and the HSL library, which requires proprietary code. MUMPS provides the same functionality and is open-source, but it was not tested (you may want to follow Installing IPOPT if you're interested by MUMPS, and edit this doc if you make it work).

You will need to get the HSL MA27 and MC19 routines, and put the code if files name respectively ma27ad.f and mc19ad.f. These routines are mandatory, i.e. without them you will be able to compile IpOpt (since it employs a runtime Linear Solver Loader) but it will not work. In the current documentation, we do not discuss the use of MA57+METIS, i.e. the successor of MA27 (if you do make it work, edit this page). The routines are available here :


Download Ipopt IpOpt source code and put it wherever you like; call this location IPOPT_DWN_DIR Download the third-party code Blas, Lapack.

cd $IPOPT_DWN_DIR/ThirdParty
cd Blas; ./get.Blas; cd ..
cd Lapack; ./get.Lapack; cd ..

Copy the MA27 and MC19 routines (ma27ad.f and mc19ad.f files) in the IPOPT_DWN_DIR/ThirdParty/HSL dir. Run configure script. We install in /usr/local. This will make brew doctor angsty, but this is by far the simplest way.

./configure --with-blas=BUILD --with-lapack=BUILD --with-hsl=BUILD --prefix=/usr/local
make test

All tests should pass.

sudo make install


TODO: write testing section

Installing iCub from sources

Once dependencies have been installed you need to retrieve the iCub source code. Just execute the following commands (choosing your preferred directory where to put the source files):

 mkdir myPrefCodeDir
 cd myPrefCodeDir
 git clone

After executing the command above, you need to compile the iCub repository as described in the linux iCub compile instructions considering that if you followed the instructions above, then ICUB_REPOSITORY=myPrefCodeDir/iCub.

Check your installation

Now you are ready to check your installation.

Additional Useful Information

Here are some useful information, mainly for problematic installations.

Do I need all these dependencies?

Depending on what iCub software you are planning to use, you do not require all the dependencies. In the following a list of the dependencies according to what you are planning to do with the iCub. The iCub simulator for example requires:

 brew install ode
 brew install sdl sdl_gfx sdl_image

The visual processing modules (e.g. stereoCalib, motionCut) require:

 brew install opencv 

The graphical user interfaces (e.g. robotMotorGui) require:

 brew install gtk+ 
 brew install gtkmm 
 brew install cairo 

The inverse kinematic modules (e.g. iKin) require:

 brew install gfortran
 brew install ipopt

Generating a Xcode project

If you installed Yarp and iCub from source, you can also compile them from an Xcode project which can be created by simply executing:

cmake . -G Xcode

Possible conflicting libraries

It may also be necessary to move any "fink"/"macport" libraries out of the way, if you have used those package managers in the past. For example, if you have a "/sw" directory, consider moving it. In any case, you should not mix Homebrew with Macport or Fink.

Python Bindings


To use the python bindings for YARP, you have to install swig first:

 brew install swig

Also, YARP must be compiled with the CREATE_SHARED_LIBRARY option enabled.

Building the bindings

When compiling YARP from source, in the ccmake screen, set:


and press c (configure) and set:


press c (configure) again and set:


(or whatever version of python your system has)

If you don't use Apple's built-in Python, you also have to set your Python's include directory and library. Toggle CMake's advanced mode by pressing t. Then find and change accordingly the following two fields:


After installation, you will need to set PYTHONPATH in .bashrc (or .bash_profile):

export PYTHONPATH=$PYTHONPATH:$YARP_DIR/lib/python2.7/site-packages

Create the documentation

In the build directory above, start a python interpreter:


and then:

 >>> import pydoc
 >>> pydoc.writedoc('yarp')

It will produce a yarp.html file

Bash completion

To install the bash completions for YARP, first you need to install the bash-completion package through Homebrew:

 brew install bash-completion

Then, just add the following to your .bash_profile:

 if [ -f `brew --prefix`/etc/bash_completion ]; then
       . `brew --prefix`/etc/bash_completion
 source $YARP_ROOT/scripts/yarp_completion
Personal tools