OpenCV Series— 1 — OpenCV and dlib installation in MacOS

Rajathithan Rajasekar
2 min readMay 3, 2020

In this post, we are going to see how to install OpenCV and dlib libraries using python in MacOS. I will be posting a series of posts on OpenCV on what i experiment with this Computer Vision and Machine Learning libraries.So let’s quickly go ahead and do the installation of OpenCV in MacOS.

First and foremost , you should have the homebrew package manager in MacOS, if you dont have one, you can install it using the below command.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Next you need to install python3 and cmake.

brew install python3
brew install cmake

Now you need to create a virtual environment in python for installing the opencv and dlib libraries.

python3 -m venv workon-opencv
echo "# Alias for OpenCV Virtual Environment" >> ~/.bash_profile
echo "alias workon-opencv=\"source $(pwd)/workon-opencv/bin/activate\"" >> ~/.bash_profile
source $(pwd)/workon-opencv/bin/activate

Now update ~/.bashrc

# Virtual Environment Wrapperalias workon-opencv="source $(pwd)/workon-opencv/bin/activate"

Now activate the virtual environment and install the necessary packages for…

--

--

Rajathithan Rajasekar
Rajathithan Rajasekar

Written by Rajathithan Rajasekar

I like to write code in Python . Interested in cloud , dataAnalysis, computerVision, ML and deepLearning. https://rajathithanrajasekar.medium.com/membership

No responses yet