

Make sure “Unix Makefiles” is selected and the radio button for “Use default native compilers” is active, then press “Done”.Īfter a few moments the configuration will end and you need to set the 3rd important folder for your OpenCV build, which is the install folder and in CMake it’s labeled as “CMAKE_INSTALL_PREFIX”, and by default it’s set to the following folder which we’re going to change: /usr/local You’ll be greeted with a dialog asking you to “Specify the generator for this project”.

If you get warning saying the build folder doesn’t exist, just answer “Yes” to the question about creating it. Now hit the “Configure” button in CMake to start the configuration process. Assuming the previous one as the source codes folder, enter something like this for the build folder: /Users/amin/dev/opencv/build You need to choose a build folder as well, so click on “Browse Build” and choose the folder where you want to use as the build folder for OpenCV.

Let’s assume it’s in the following folder: /Users/amin/dev/opencv This is the path to the OpenCV source codes, either the ones you cloned from GitHub or the ones you extracted from a zip file you downloaded from OpenCV website. Run CMake and choose the sources folder by clicking on “Browse Source”. Now make sure you have CMake on your computer since we’re going to configure OpenCV for building. Here is a screenshot showing how the latest version of OpenCV is fetched on macOS using Sourcetree: Switch to the latest version by using the Tags.Clone OpenCV sources from GitHub, either using the Terminal (if you desperately want to torture yourself) or using a nice Git client (such as Sourcetree or anything else you use for that reason).Now start by getting the source codes from OpenCV website, by going to the Releases page and downloading the highest version of OpenCV 4 you can find there, which at the time of writing this article is OpenCV 4.1.0.Īs a tip for professional users, here’s how I usually do it instead of getting a zipped copy of source codes: If you don’t have Xcode, just go to App Store and get it using this link. This guide is quite similar to my previous How-Tos about building OpenCV from source codes and using them in Qt, but I wanted to created a fresh one and point out a few of the changes made in this recent OpenCV version that requires you to reconfigure your Qt projects just a bit.įirst things first, you must have installed Xcode before everything else.
