Title: macOS: Install OpenCV 3 and Python 3.5 - PyImageSearch

URL Source: https://pyimagesearch.com/2016/12/05/macos-install-opencv-3-and-python-3-5/

Published Time: 2016-12-05T15:00:50+00:00

Markdown Content:
![Image 1: sierra_os_contours_example](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20450'%3E%3C/svg%3E)

Last week I covered [how to install OpenCV 3 with Python 2.7 bindings on macOS Sierra](https://pyimagesearch.com/2016/11/28/macos-install-opencv-3-and-python-2-7/) and above.

In today’s tutorial we’ll learn how to install **OpenCV 3 with _Python 3.5_** bindings on macOS.

I decided to break these install tutorials into two separate guides to keep them well organized and easy to follow.

**To learn how to install OpenCV 3 with Python 3.5 bindings on your macOS system, _just keep reading._**

As I mentioned in the introduction to this post, I spent last week covering [how to install OpenCV 3 with Python 2.7 bindings on macOS](https://pyimagesearch.com/2016/11/28/macos-install-opencv-3-and-python-2-7/).

Many of the steps in last week’s tutorial and today’s tutorial are very similar (and in some cases identical) so I’ve tried to trim down some of the explanations for each step to reduce redundancy. If you find any step confusing or troublesome I would suggest referring to the [OpenCV 3 + Python 2.7](https://pyimagesearch.com/2016/11/28/macos-install-opencv-3-and-python-2-7/) tutorial where I have provided more insight.

The exception to this is _“Step #7: Configure OpenCV 3 and Python 3.5 via CMake on macOS”_ where I provide an **_extremely thorough walkthrough_** on how to configure your OpenCV build. You should pay _extra special attention to this step_ to ensure your OpenCV build has been configured correctly.

With all that said, let’s go ahead and install OpenCV 3 with Python 3.5 bindings on macOS.

### Step #1: Install Xcode

Before we can compile OpenCV on our system, we first need to install Xcode, Apple’s set of software development tools for the Mac Operating System.

The easiest method to download Xcode is to open up the _App Store_ application on your desktop, search for _“Xcode”_ in the search bar, and then click the _“Get”_ button:

![Image 2: Figure 1: Downloading and installing Xcode on macOS.](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20510'%3E%3C/svg%3E)

**Figure 1:** Downloading and installing Xcode on macOS.

After installing Xcode you’ll want to open up a terminal and ensure you have [accepted the developer license](http://apple.stackexchange.com/questions/175069/how-to-accept-xcode-license):

$ sudo xcodebuild -license

We also need to install the Apple Command Line Tools. These tools include programs and libraries such as GCC, make, clang, etc. You can use the following command to install the Apple Command Line Tools:

$ sudo xcode-select --install

When executing the above command a confirmation window will pop up asking for you to confirm the install:

![Image 3: Figure 2: Installing the Apple Command Line Tools on macOS.](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20554%20440'%3E%3C/svg%3E)

**Figure 2:** Installing the Apple Command Line Tools on macOS.

Click the _“Install”_ button to continue. The actual installation process should take less than 5 minutes to complete.

### Step #2: Install Homebrew

The next step is to install [Homebrew](http://brew.sh/), a package manager for macOS. You can think of Homebrew as the macOS equivalent of Ubuntu/Debian-based _apt-get_.

Installing Homebrew itself is super easy, just copy and paste the _entire_ command below:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Once Homebrew is installed you should make sure the package definitions are up to date by running:

$ brew update

We now need to update our `~/.bash_profile` file (or create it if it doesn’t exist already). Open up the file using your favorite text editor (I’m using `nano` in this case):

$ nano ~/.bash\_profile

And then add the following lines to the file:

\# Homebrew
export PATH=/usr/local/bin:$PATH

This `export` command simply updates the `PATH` variable to look for binaries/libraries along the _Homebrew path_ before the _system path_ is consulted.

I have included a screenshot of what my `~/.bash_profile` looks like as reference below:

![Image 4: Figure 3: Updating my .bash_profile file to include Homebrew.](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20373'%3E%3C/svg%3E)

**Figure 3:** Updating my _.bash\_profile_ file to include Homebrew.

After updating your `.bash_profile` file, save and exitor the editor followed by using `source` to ensure the changes to the `.bash_profile` are manually reloaded:

$ source ~/.bash\_profile

This command only needs to be executed _once_. Anytime you open up a new terminal your `.bash_profile` will _**automatically**_ be `source` ‘d for you.

### Step #3: Setup Homebrew for Python 3.5 and macOS

It is considered bad form to develop against the system Python as your main interpreter. The system version of Python should serve only one purpose — _support system routines and operations._ There is also the fact that macOS _does not_ ship with Python 3 out of the box.

Instead, you should install your own version of Python that is _independent_ from the system install. Using Homebrew, we can install Python 3 using the following command:

$ brew install python3

_**Note:** Make sure you don’t forget the “3” in “python3”. The above command will install Python 3.5 on your system. However, if you leave off the “3” you’ll end up installing Python 2.7._

As a sanity check, it’s important to confirm that you are using the _Homebrew version of Python 3_ rather than the _system version of Python 3_. To accomplish this, simply use the `which` command:

$ which python3
/usr/local/bin/python3

**Important:** Inspect this output closely. If you see `/usr/local/bin/python3` then you are _correctly_ using the _Homebrew version of Python_. However, if the output is `/usr/bin/python3` then you are _incorrectly_ using the _system version of Python_.

If you find yourself using the system version of Python instead of the Homebrew version you should:

1.  Ensure Homebrew installed without error.
2.  Check that `brew install python3` finished successfully.
3.  You have properly updated your `~/.bash_profile` and reloaded the changes using `source` . This basically boils down to making sure your `~/.bash_profile` looks like mine above in **Figure 3**.

### Step #4: Install Python virtual environments and NumPy

We’ve made good progress so far. We’ve installed a non-system version of Python 3 via Homebrew. However, let’s not stop there. Let’s install both [virtualenv](https://virtualenv.pypa.io/en/latest/) and [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/) so we can create _separate, independent_ Python environments for each project we are working on — this is considered a best practice when developing software in the Python programming language.

I’ve already discussed Python virtual environments _ad nauseam_ in previous blog posts, so if you’re curious about how they work and why we use them, please refer to the [first half of this blog post](https://pyimagesearch.com/2016/05/02/accessing-rpi-gpio-and-gpio-zero-with-opencv-python/). I also _highly recommend_ reading through this excellent tutorial on the [RealPython.com blog](https://realpython.com/blog/python/python-virtual-environments-a-primer/) that takes a deeper dive into Python virtual environments.

#### Install virtualenv and virtualenvwrapper

Installing both `virtualenv` and `virtualenvwrapper` is a snap using `pip` :

$ pip install virtualenv virtualenvwrapper

After these packages have been installed we need to update our `~/.bash_profile` again:

$ nano ~/.bash\_profile

Once opened, append the following lines to the file:

\# Virtualenv/VirtualenvWrapper
source /usr/local/bin/virtualenvwrapper.sh

After updating, your `~/.bash_profile` should look similar to mine:

![Image 5: Figure 4: Updating your .bash_profile file to include virtualenv/virtualenvwrapper.](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20370'%3E%3C/svg%3E)

**Figure 4:** Updating your .bash\_profile file to include virtualenv/virtualenvwrapper.

After updating your `.bash_profile` , save it, exit, and then once again `source` it:

$ source ~/.bash\_profile

I’ll reiterate that this command only needs to be executed _once_. Each time you open up a new terminal window this file will _**automatically**_ be `source` ‘d for you.

#### Create your Python 3 virtual environment

We can now use the `mkvirtualenv` command to create a Python 3 virtual environment named `cv` :

$ mkvirtualenv cv -p python3

The `-p python3` switch ensures that a Python 3 virtual environment is created instead of a Python 2.7 one.

Again, the above command will create a Python environment named `cv` that is _independent_ from all other Python environments on your system. This environment will have it’s own `site-packages` directory, etc., allowing you to avoid any type of library versioning issues across projects.

The `mkvirtualenv` command only needs to be executed once. To access the `cv` Python virtual environment _after_ it has been created, just use the `workon` command:

$ workon cv

To validate that you are in the `cv` virtual environment, just examine your command line. If you see the text `(cv)` preceding the prompt, then you are **_are_** in the `cv` virtual environment:

![Image 6: Figure 6: Make sure you see the "(cv)" text on your prompt, indicating that you are in the cv virtual environment.](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20331'%3E%3C/svg%3E)

**Figure 5:** Make sure you see the _“(cv)”_ text on your prompt, indicating that you _**are**_ in the _cv_ virtual environment.

Otherwise, if you **_do not_** see the `cv` text, then you **_are not_** in the `cv` virtual environment:

![Image 7: Figure 7: If you do not see the "(cv)" text on your prompt, then you are not in the cv virtual environment and you need to run the "workon" command to resolve this issue before continuing.](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20331'%3E%3C/svg%3E)

**Figure 6:** If you do not see the _“(cv)”_ text on your prompt, then you _**are not**_ in the _cv_ virtual environment and you need to run the _“workon”_ command to resolve this issue before continuing.

If you find yourself in this situation all you need to do is utilize the `workon` command mentioned above.

#### Install NumPy

The only Python-based prerequisite that OpenCV needs is [NumPy](http://www.numpy.org/), a scientific computing package.

To install NumPy into our `cv` virtual environment, ensure you are in the `cv` environment (otherwise NumPy will be installed into the _system_ version of Python) and then utilize `pip` to handle the actual installation:

$ pip install numpy

### Step #5: Install OpenCV prerequisites using Homebrew

OpenCV requires a few prerequisites to be installed before we compile it. These packages are related to either (1) tools used to build and compile, (2) libraries used for image I/O operations (i.e., loading various image file formats from disk such as JPEG, PNG, TIFF, etc.) or (3) optimization libraries.

To install these prerequisites for OpenCV on macOS execute the following commands:

$ brew install cmake pkg-config
$ brew install jpeg libpng libtiff openexr
$ brew install eigen tbb

### Step #6: Download the OpenCV 3 source from GitHub

As I detailed in [last week’s tutorial](https://pyimagesearch.com/2016/11/28/macos-install-opencv-3-and-python-2-7/), OpenCV 3 on macOS needs to be compiled via the _latest commit to GitHub_ instead of an actual _tagged release_ (i.e., 3.0, 3.1, etc.). This is because the current tagged releases of OpenCV do not provide fixes for the QTKit vs. AVFoundation errors (please see last week’s blog post for a thorough discussion on this).

First, we need to download the [OpenCV GitHub repo](https://github.com/opencv/opencv):

$ cd ~
$ git clone https://github.com/opencv/opencv

Followed by the [opencv\_contrib repo](https://github.com/opencv/opencv_contrib):

$ git clone https://github.com/opencv/opencv\_contrib

### Step #7: Configure OpenCV and Python 3.5 via CMake on macOS

This section of the tutorial is the _most challenging_ and the one that you’ll _want to pay the most attention to._

First, I’ll demonstrate how to setup your build by creating the a `build` directory.

I then provide a CMake template that you can use to start the process of compiling OpenCV 3 with Python 3.5 bindings on macOS. This template requires you to fill in two values:

1.  The path to your `libpython3.5.dylib` file.
2.  The path to your `Python.h` headers for Python 3.5.

_**I will help you find and determine the correct values for these paths.**_

Finally, I provide a fully completed CMake command _as an example._ Please note that is command is _specific to my machine._ Your CMake command may be slightly different due to the paths specified. Please read the rest of this section for details.

#### Setting up the build

In order to compile OpenCV with Python 3.5 bindings for macOS we first need to set up the build. This simply amounts to changing directories and creating a `build` directory:

$ cd ~/opencv
$ mkdir build
$ cd build

#### OpenCV 3 + Python 3.5 CMake template for macOS

The next part, where we configure our actual build, gets a little tricky. In order to make this process easier I have constructed the following _**OpenCV 3 + Python 3.5 CMake template:**_

$ cmake -D CMAKE\_BUILD\_TYPE=RELEASE \\
    -D CMAKE\_INSTALL\_PREFIX=/usr/local \\
    -D OPENCV\_EXTRA\_MODULES\_PATH=~/opencv\_contrib/modules \\
    -D PYTHON3\_LIBRARY=YYY \\
    -D PYTHON3\_INCLUDE\_DIR=ZZZ \\
    -D PYTHON3\_EXECUTABLE=$VIRTUAL\_ENV/bin/python \\
    -D BUILD\_opencv\_python2=OFF \\
    -D BUILD\_opencv\_python3=ON \\
    -D INSTALL\_PYTHON\_EXAMPLES=ON \\
    -D INSTALL\_C\_EXAMPLES=OFF \\
    -D BUILD\_EXAMPLES=ON ..

Looking at this template I want to point out a few things to you:

1.  `BUILD_opencv_python2=OFF` : This switch indicates that we _do not_ want to build Python 2.7 bindings. This needs to be _explicity stated_ in the CMake command. Failure to do this can cause problems when we actually run CMake.
2.  `BUILD_opencv_python3=ON` : We would like for OpenCV 3 + Python 3.5 bindings to be built. This instruction indicates to CMake that the Python 3.5 binding should be built rather than Python 2.7.
3.  `PYTHON3_LIBRARY=YYY` : This is the **_first_** value that you need to fill in yourself. You need to replace `YYY` with the path to your `libpython3.5.dylib` file. I will hep you find the path to this value in the next section.
4.  `PYTHON3_INCLUDE_DIR=ZZZ` : This is the **_second_** value that you need to fill in. You will need to replace `ZZZ` with the path to your `Python.h` headers. Again, I will help you determine this path.

#### Determining your Python 3.5 library and include directory

We will start by configuring your `PYTHON3_LIBRARY` value. This switch should point to your `libpython3.5.dylib` file. This file is located within many nested subdirectories of `/usr/local/Cellar/python` . To find the _exact path_ to the `libpython3.5.dylib` file, just use the `ls` command with a wildcard (auto-tab complete also works as well):

$ ls /usr/local/Cellar/python3/3.\*/Frameworks/Python.framework/Versions/3.5/lib/python3.5/config-3.5m/libpython3.5.dylib
/usr/local/Cellar/python3/3.5.2\_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/config-3.5m/libpython3.5.dylib

Take note of the output of this command — _**this is the full path to your `libpython3.5.dylib` file and will replace `YYY` in the CMake template above.**_

Let’s move along to determining the `PYTHON3_INCLUDE_DIR` variable. This path should point to the `Python.h` header files for Python 3.5 used to generate the actual OpenCV 3 + Python 3.5 bindings.

Again, we’ll use the same `ls` and wildcard trick here to determine the proper path:

$ ls -d /usr/local/Cellar/python3/3.\*/Frameworks/Python.framework/Versions/3.5/include/python3.5m/
/usr/local/Cellar/python3/3.5.2\_3/Frameworks/Python.framework/Versions/3.5/include/python3.5m/

The output of the `ls -d` command is our full path to the `Python.h` headers. **_This value will replace `ZZZ` in the CMake template._**

#### Filling in the CMake template

Now that we’ve determined the `PYTHON3_LIBRARY` and `PYTHON3_INCLUDE_DIR` values we need to update the CMake command to reflect these paths.

On my machine, the _full_ CMake command to configure my OpenCV 3 + Python 3.5 build looks like:

$ cmake -D CMAKE\_BUILD\_TYPE=RELEASE \\
    -D CMAKE\_INSTALL\_PREFIX=/usr/local \\
    -D OPENCV\_EXTRA\_MODULES\_PATH=~/opencv\_contrib/modules \\
    -D PYTHON3\_LIBRARY=/usr/local/Cellar/python3/3.5.2\_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/config-3.5m/libpython3.5.dylib \\
    -D PYTHON3\_INCLUDE\_DIR=/usr/local/Cellar/python3/3.5.2\_3/Frameworks/Python.framework/Versions/3.5/include/python3.5m/ \\
    -D PYTHON3\_EXECUTABLE=$VIRTUAL\_ENV/bin/python \\
    -D BUILD\_opencv\_python2=OFF \\
    -D BUILD\_opencv\_python3=ON \\
    -D INSTALL\_PYTHON\_EXAMPLES=ON \\
    -D INSTALL\_C\_EXAMPLES=OFF \\
    -D BUILD\_EXAMPLES=ON ..

_However, please do not copy and paste my exact CMake command_ — make sure you have used the instructions above to properly determine your `PYTHON3_LIBRARY` and `PYTHON3_INCLUDE_DIR` values.

Once you’ve filled in these values, execute your `cmake` command and your OpenCV 3 + Python 3.5 build will be configured.

As an example, take a look at the `Python 3` section output from my configuration:

![Image 8: Figure 7: Ensuring that Python 3.5 will be used when compiling OpenCV 3 for macOS.](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20373'%3E%3C/svg%3E)

**Figure 7:** Ensuring that Python 3.5 will be used when compiling OpenCV 3 for macOS.

In particular, you’ll want to make sure that:

1.  The `Interpreter` points to the Python binary in your `cv` virtual environment.
2.  `Libraries` points to your `libpython3.5.dylib` file.
3.  The `numpy` version being utilized is the one you installed in your `cv` virtual environment.

### Step #8: Compile and install OpenCV 3 on macOS

After investigating your `cmake` command and ensuring it exited without error (and that the `Python 3` section was properly configured), you can now compile OpenCV:

$ make -j4

In this case, I am supplying `-j4` to compile OpenCV using all four cores on my machine. You can tune this value based on the number of processors/cores you have.

OpenCV can take awhile to compile, anywhere from 30-90 minutes, depending on your system specs. I would consider going for a nice long walk while it compiles.

A successful compile will end with a 100% completion:

![Image 9: Figure 9: Successfully compiling OpenCV 3 from source with Python 2.7 bindings on macOS.](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20372'%3E%3C/svg%3E)

**Figure 8:** Successfully compiling OpenCV 3 from source with Python 3.5 bindings on macOS.

Assuming that OpenCV compiled without error, you can now install it on your macOS system:

$ sudo make install

### Step #9: Rename and sym-link your OpenCV 3 + Python 3.5 bindings

After running `sudo make install` your OpenCV 3 + Python 3.5 bindings should be located in `/usr/local/lib/python3.5/site-packages` . You can verify this by using the `ls` command:

$ cd /usr/local/lib/python3.5/site-packages/
$ ls -l \*.so
-rwxr-xr-x  1 root  admin  3694564 Nov 15 11:28 cv2.cpython-35m-darwin.so

I’ve been perplexed by this behavior ever since OpenCV 3 was released, but for some reason, when compiling OpenCV with Python 3 support enabled the output `cv2.so` bindings are named differently. The actual filename will vary a bit depending on your system architecture, but it should look something like `cv2.cpython-35m-darwin.so` .

Again, I don’t know exactly why this happens, but it’s an easy fix. All we need to do is rename the file to `cv2.so` :

$ cd /usr/local/lib/python3.5/site-packages/
$ mv cv2.cpython-35m-darwin.so cv2.so
$ cd ~

After renaming `cv2.cpython-35m-darwin.so` to `cv2.so` we then need to sym-link our OpenCV bindings into the `cv` virtual environment for Python 3.5:

$ cd ~/.virtualenvs/cv/lib/python3.5/site-packages/
$ ln -s /usr/local/lib/python3.5/site-packages/cv2.so cv2.so
$ cd ~

### Step #10: Verify your OpenCV 3 install on macOS

To verify that your OpenCV 3 + Python 3.5 installation on macOS is working you should:

1.  Open up a new terminal.
2.  Execute the `workon` command to access the `cv` Python virtual environment.
3.  Attempt to import the Python + OpenCV bindings.

Here are the exact steps you can use to test the install:

$ workon cv
$ python
Python 3.5.2 (default, Oct 11 2016, 04:59:56) 
\[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)\] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.\_\_version\_\_
'3.1.0-dev'
>>>

_**Note:** Take note of the `-dev`  in the `cv2.__version__` . This indicates that we are using the development version of OpenCV and not a tagged release. Once OpenCV 3.2 is released these instructions can be updated to simply download a .zip of the tagged version rather than having to clone down the entire repositories._

I’ve also included a screenshot below that utilizes these same steps. As you can see, I can access my OpenCV 3 bindings from Python 3.5 shell:

![Image 10: Figure 9: Ensuring that I have successfully installed my OpenCV 3 + Python 3.5 bindings on macOS.](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20260'%3E%3C/svg%3E)

**Figure 9:** Ensuring that I have successfully installed my OpenCV 3 + Python 3.5 bindings on macOS.

_**Congratulations, you have installed OpenCV with Python 3.5 bindings on your macOS system!**_

So, what’s next?
----------------

Congrats! You now have a brand new, fresh install of OpenCV on your macOS system — and I’m sure you’re just itching to leverage your install to build some awesome computer vision apps…

…but I’m also willing to bet that _you’re just getting started learning computer vision and OpenCV_, and probably feeling a bit confused and overwhelmed on exactly where to start.

Personally, I’m a big fan of **learning by example**, so a good first step would be to have some fun and [read this blog post on detecting cats in images/videos](https://pyimagesearch.com/2016/06/20/detecting-cats-in-images-with-opencv/). This tutorial is meant to be _very hands-on_ and demonstrate how you can (quickly) build a Python + OpenCV application to detect the presence of cats in images.

And if you’re _really interested_ in leveling-up your computer vision skills, you should definitely check out my book, _[Practical Python and OpenCV + Case Studies](https://pyimagesearch.com/practical-python-opencv/)_. My book not only _covers the basics of computer vision and image processing_, but also teaches you how to solve real-world computer vision problems including _**face detection in images and video streams**_, **_object tracking in video_**, and _**handwriting recognition**_.

[![Image 11: curious_about_cv](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20400%20400'%3E%3C/svg%3E)](https://pyimagesearch.com/practical-python-opencv/)

So, let’s put that fresh install of OpenCV 3 on your macOS system to good use

### What's next? We recommend [PyImageSearch University](https://pyimagesearch.com/pyimagesearch-university/?utm_source=blogPost&utm_medium=bottomBanner&utm_campaign=What%27s%20next%3F%20I%20recommend).

**Course information:**  
84 total classes • 114+ hours of on-demand code walkthrough videos • Last updated: February 2024  
★★★★★ 4.84 (128 Ratings) • 16,000+ Students Enrolled

**I strongly believe that if you had the right teacher you could _master_ computer vision and deep learning.**

Do you think learning computer vision and deep learning has to be time-consuming, overwhelming, and complicated? Or has to involve complex mathematics and equations? Or requires a degree in computer science?

That’s _not_ the case.

All you need to master computer vision and deep learning is for someone to explain things to you in _simple, intuitive_ terms. _And that’s exactly what I do_. My mission is to change education and how complex Artificial Intelligence topics are taught.

If you're serious about learning computer vision, your next stop should be PyImageSearch University, the most comprehensive computer vision, deep learning, and OpenCV course online today. Here you’ll learn how to _successfully_ and _confidently_ apply computer vision to your work, research, and projects. Join me in computer vision mastery.

**Inside PyImageSearch University you'll find:**

*   ✓ **84 courses** on essential computer vision, deep learning, and OpenCV topics
*   ✓ **84 Certificates** of Completion
*   ✓ **114+ hours** of on-demand video
*   ✓ **Brand new courses released _regularly_**, ensuring you can keep up with state-of-the-art techniques
*   ✓ **Pre-configured Jupyter Notebooks in Google Colab**
*   ✓ Run all code examples in your web browser — works on Windows, macOS, and Linux (no dev environment configuration required!)
*   ✓ Access to **centralized code repos for _all_ 536+ tutorials** on PyImageSearch
*   ✓ **Easy one-click downloads** for code, datasets, pre-trained models, etc.
*   ✓ **Access** on mobile, laptop, desktop, etc.

[Click here to join PyImageSearch University](https://pyimagesearch.com/pyimagesearch-university/?utm_source=blogPost&utm_medium=bottomBanner&utm_campaign=What%27s%20next%3F%20I%20recommend)

Summary
-------

In this tutorial you learned how to compile and install OpenCV 3 with Python 3.5 bindings on macOS Sierra.

To accomplish this, we configured and compiled OpenCV 3 by hand using the CMake utility. While this isn’t exactly the most “fun” experience, it _does_ give us _complete and total control_ over the install.

If you’re looking for an _easier_ way to get OpenCV installed on your Mac system be sure to stay tuned for next week’s blog post where I demonstrate how to install OpenCV on macOS using nothing but Homebrew.

_**To be notified when this blog post goes live, please enter your email address in the form below and I’ll be sure to ping you when the tutorial is published.**_

![Image 12](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20410%20567'%3E%3C/svg%3E)

#### Join the PyImageSearch Newsletter and Grab My FREE 17-page Resource Guide PDF

Enter your email address below to **join the PyImageSearch Newsletter** and **download my FREE 17-page Resource Guide PDF** on Computer Vision, OpenCV, and Deep Learning.