
D PYTHON2_INCLUDE_DIR=/usr/local/Frameworks/amework/Headers \ D PYTHON2_LIBRARY=/usr/local/opt/python/bin \

D PYTHON2_PACKAGES_PATH=/usr/local/lib/python2.7/site-packages \ D CMAKE_INSTALL_PREFIX=/usr/local/opencv3 \ Run CMake with the appropriate parameters for your system: Make build directory inside opencv directory.Clone OpenCV and OpenCV_Contrib git repos:.Install dependencies like CMake, pkg-config (and possibly others.).Your next best approach is to bypass using package manager, like brew, and follow the instructions given on PyImageSearch to build OpenCV manually using CMake: And with no other power-hungry apps running in the background, it finished in 25mins. Solution: was to just let it run with as much CPU and memory overhead it needs. So I shut down Safari, Finder, IDEs (XCode, P圜harm) etc, and this time it did complete. But I had several apps running that were robbing it of CPU and Memory resources. I went ahead and tracked the processes in the Activity Monitor on my Mac and found out that it kicks off a batch of clang processes in sequence on multiple threads. DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -DCMAKE In my case though, it would go a step further and get stuck after calling make for hours: cmake.

Someone else had also reported this problem on the brew github, but they could also not reproduce the issue.
