Hide menu

OpenCV Installation Mac OS

Before compiling OpenCV, a number of tools and libraries need to be installed:

  • XCode - the compiler from XCode is required. XCode is available in the App Store.
  • CMake - a binary package version 2.8.8 is available here
  • Download Python's easy_install
  • Open a console and type
    sudo python ez_setup.py
  • Sphinx is required to build the documentation. In console type
    easy_install -U Sphinx
  • Numpy is required for the Python-wrappers. It is contained in Scipy Superpack which is installed using this shell script IFF you are using Mac OS X 10.8 Mountain Lion. If you are using Mac OS X 10.7, please follow the instructions are the bottom of this page .
  • MacTeX is required to build the documentation. Version MacTeX-2012 is available here . Note that the command line tools (/usr/texbin) have to be added to PATH.
  • Optional: to get nicer GUI, you may want to install the Qt libraries, version 4.8.2 is available here
  • Optional: to get multi-threading, you may want to install the TBB libraries, version 4.0 update 5 is available here . After downloading and unpacking, run at console
    sudo mv tbb40_20120613oss /usr/local/share/
  • If you want to run any OpenCV application, you need to enter (or add to the environment)
    export DYLD_LIBRARY_PATH=/usr/local/share/tbb40_20120613oss/lib/
  • Optional: to get some extra support for linear algebra, you may want to install the Eigen library, version 3.1.1 is available here . Just copy the header files to an appropriate place by unzipping, changing into the folder, and typing
    sudo mv eigen-eigen-43d9075b23ef /usr/local/share/eigen
  • Eclipse - the IDE that we use in the course. Version 4.2 is available here
  • Within Eclipse go to Help/Marketplace , choose the orange circle and install Eclox (for documentation) and Subclipse (for repository access)

Now it is time to download OpenCV sources.

  • Create a folder source at a place of your choice
  • Download the sources to that folder. OpenCV version 2.4.2 is available here
  • Create a folder build at a place of your choice and change to that folder
  • Launch a console and type
    cmake-gui source
  • Choose Eclipse
  • Adjust settings: activate examples, add Eclipse path, add Eigen path, remove precompiled headers, remove CUDA and CUFFT, remove TIFF, remove FFMPEG, add Qt (if installed), add TBB (if installed) including paths
  • Click on configure & generate and quit (do not close the console)
  • Launch Eclipse and choose import/general/existing project (do not tick copy )
  • Run build
  • Run project/make target/build and choose docs or html-docs
  • Quit Eclipse
  • Back at the console,  run
    sudo make install
  • In future Eclipse projects: just add OpenCV libraries as required, that is it!

Last updated: 2014-03-18