Install OpenCV + OpenCL support with Macport to Macbook Air

My Macbook Air comes with Intel HD Graphic 4000 card, so in order to take advantage of GPU, I will install OpenCV with OpenCL support. (no CUDA for my Macbook Air)

I would use Mac Port to install opencv.

If you have installed OpenCV with Mac Port before, then uninstall it in terminal by

sudo port uninstall opencv

To install OpenCV with OpenCL support, first edit the port file for opencv

sudo port edit --editor nano opencv

This will bring up an editor with opencv port file. Look for the line written:


and Change it to


Then use Mac Port to install OpenCV + OpenCL:

sudo port install -d opencv +opencl

If there is no error, the installation should be done.

Read More