Enable "locate" command in Mac OS

Install OpenCV 2.4.3 Mac OS X (Mountain Lion)

Author posted @ 2013年3月27日 11:29 in Mac OS , 3259 阅读



Syntro has been tested on Mac OS X 10.7.3, but will probably work fine with other versions as long as the dependencies are met.

Syntro relies on XcodeQtpkg-config and optionally OpenCV for some of the demo apps.

Xcode provides the compiler suite and Git for source control.

We are using pkg-config and OpenCV from the MacPorts project.

Install Xcode

Syntro has been tested with the Xcode 4.2.x tools, but the example will use the latest.

Download Xcode 4.3.2 for Lion from the Apple App store.

The file will be called xcode_432_lion.dmg.

Install it by dragging it to the Applications folder.

Install Xcode Command Line Tools

Start Xcode and select the Xcode | Preferences… menu.

In the dialog that appears, go to the Downloads tab and install the Command Line Tools

Verify the compiler and git are installed and work from the command line

$ g++ --version
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO

$ git --version
git version (Apple Git-26)

Install MacPorts

Follow the instructions from the MacPorts guide.

We use the Mac OS X Package Install method.

Install OpenCV and pkg-config from MacPorts

Update MacPorts and install OpenCV

$ sudo port selfupdate
$ sudo port install opencv pkgconfig

OpenCV will be installed in /opt/local directories.

You can check that both pkg-config and opencv are setup correctly this way

$ pkg-config opencv --cflags
-I/opt/local/include/opencv -I/opt/local/include

$ pkg-config opencv --libs
-L/opt/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann

You may have to add /opt/local/bin to your PATH to find MacPorts binaries.

Install Qt Binaries

Syntro requires Qt 4.7 or greater.

Download  >qt-mac-opensource-4.8.1.dmg from http://qt.nokia.com/downloads/qt-for-open-source-cpp-development-on-mac-os-x

Install Qt by first opening the dmg file with >DiskImageMounter or by double-clicking if you have that enabled. When the new folder opens with the contents of the dmg, there will be aQt.mkpkg file. Open this with Installer or again by double-clicking. This will launch the Qt install program.

Accept the defaults and Qt will be installed under /Library/Frameworks

Configuring QMake mkspecs

The Syntro .pro files require the macx-g++ build specs rather then the default macx-xcodespecs.

If you understand what this means and require macx-xcode for other Qt projects, then you probably know how to customize the behavior, either by using a  -spec argument to qmake or with the QMAKESPEC environment variable.

The following instructions will change the default for all Qt qmake usage.

$ cd /usr/local/Qt4.8/mkspecs
/usr/local/Qt4.8/mkspecs$ ls -l default
lrwxr-xr-x 1 504 wheel 10 Apr 10 10:04 default -> macx-xcode

/usr/local/Qt4.8/mkspecs$ sudo rm default
/usr/local/Qt4.8/mkspecs$ sudo ln -s macx-g++ default

/usr/local/Qt4.8/mkspecs$ cd ~
$ qmake --version
QMake version 2.01a
Using Qt version 4.8.1 in /Library/Frameworks

QtCreator IDE (optional)

Qt provides a cross-platform IDE for application development.

All of the Syntro applications can be built from a Terminal shell or a remote SSH shell so installing Qt Creator is optional.

If you plan on developing custom Syntro applications on the Mac, then you probably want to install Qt Creator.

Download  >http://qt.nokia.com/downloads/qt-creator-binary-for-mac.

Install QtCreator by double-clicking the dmg file. A new folder will open with two items, a  Qt Creator icon and an Applications icon. Drag the Qt Creator icon over to the Applications icon. This will launch the installer. Follow the instructions for a default install.  Qt Creator  will now be available in vertical-align: baseline; Launchpad.


Your Mac system is now ready for Building Syntro on Mac OS X.

登录 *

loading captcha image...
or Ctrl+Enter