[Installation]Installing OpenCV 2.4.10 on Yosemite

Newest version of OpenCV 2.4.10 is out and ready for download!

Check if Xcode is installed

First check if Xcode is installed on your machine. To do that, open a Terminal and type:

$ xcode-select -p

This gives you the path to your installed xcode. If you see

$ /Applications/Xcode.app/Contents/Developer/

Your xcode is fully installed! You can also check the version of your xcode by typing:

$ /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -version

Download a Package Manager

Multiple package managers do the job. (e.g. Macports, Fink or Homebrew). In my case I used Macports, so everything below is based on Macports. You can check to see if it installed successfully by opening your terminal and typing:

$ port

Use Macports to get cmake

In your terminal, type in the following:

$ sudo port install cmake

This will go fetch cmake and its dependencies and install them onto your system. You can check to see if cmake is installed by typing

$ cmake

Download and Build OpenCV

Sometimes opencv.org just failed to load. I downloaded the latest OpenCV from SourceForge. (They update it so you always get the newest version!)

Download the .zip file and unzip it to a directory. We are going to build OpenCV using cmake. In terminal, go to the directory where OpenCV was extracted to. Type in the following to make a separate directory for building purpose:

mkdir build
cd build
cmake -G "Unix Makefiles" ..

Notice that there is a space before the two ending dots.

Now, we can make OpenCV. Type the following in:

make -j8
sudo make install

This should now build OpenCV into your /usr/local/ directory.

If you want to double check to ensure it is installed, go to the directory /usr/local/lib (to do this, click the ‘Go’ tab at the top of your screen and click ‘Go to folder’ to type in the directory). Clean up the files by ‘Date Modified’, you can see those **2.4.10.dylib files.

Congratulations! Now you can do a bunch of super duper cool stuff with this awesome vision tool.

Advertisements

4 thoughts on “[Installation]Installing OpenCV 2.4.10 on Yosemite

  1. Im having problems in the step, where I want to do the mkdir build, cd build and the Unix Makefiles, my terminal says this after I insert the 3rd line
    The source directory “/Users/MYNAME/build/build/” does not appear to contain CMakeLists.txt.
    and every time I try it again I see one more build in the lines and if I look for it in the folders there are more and more folders of build which happen to be empty

    any suggestions will be of great help
    Thank you

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s