Building OpenCV as a macOS Universal Intel Binary


Posted by Jaime | Posted in Coding | Posted on 02-03-2017

Tags: , , , ,

So, for my project, I needed an Intel Universal build of the OpenCV library.

The copy of the OpenCV source I have on my machine is version 3.0.0 and it has worked well for me, so I’ll start with that.

My build machine is running macOS 10.12 and has Xcode 8 installed on it.

OpenCV uses cmake for its build system, so you have to download and install the CMake app for macOS. I got my copy from

I referred to the article listed on Wired Watershed to help me get started.

I made the following changes to the project once was done processing the source folder.

  • Set CMAKE_OSX_DEPLOYMENT to 10.8, since my project needed it.
  • Unchecked 1394

However, when the 32-bit portion of the project went to build, it reported the following error: fatal error: ‘QTKit/QTKit.h’ file not found.

Apparently, this is a known issue.

So, I thought I could solve this problem by going to version 3.2.0… off to GitHub

I cloned the master branch to my machine and ran CMake again on the new source, but when I build the project with Xcode 8, I saw other problems.


  • I unchecked WITH_LAPACK
  • I had to go into the Xcode project and set the C version to c11, and the C++ version to c++14.

Ok, things are getting better, but… the code doesn’t compile for 32-bit.


This can be fixed by … fixing the code?

Off to GitHub again, where I forked the OpenCV project and fixed the Obj-C++ code so that it will build for 32-bit Intel.

With that done, I create a pull request.

If you would like your own copy of the code I modified, you can clone the forked OpenCV repo.