


This is potentially what you have done for the Include and Library search path variables but for some reason Xcode does not find if you do not modify these variables. Notice that there will be -I/usr/local/Cellar/opencv/4.2.0_1/include/opencv4/opencv -I/usr/local/Cellar/opencv/4.2.0_1/include/opencv4 and -L/usr/local/Cellar/opencv/4.2.0_1/lib in the results. Remember using pkg-config tool? Basically, we will take that entire output and add them to Other Linker Flags variable. When modify them, you will see a non-recursive option on the right side of the entry, make it recursive. If installed via homebrew, then it is most likely under /usr/local/Cellar/. You need to find where the library is installed. Search with "Search Path" phrase and modify Include Search Path and Library Search Path variables. Once the OpenCV is successfully installed, create a new Xcode project for macOS as a Command Line Tool and go to the Build Settings. It will give something like this: -I/usr/local/Cellar/opencv/4.2.0_1/include/opencv4/opencv -I/usr/local/Cellar/opencv/4.2.0_1/include/opencv4 -L/usr/local/Cellar/opencv/4.2.0_1/lib -lopencv_gapi -lopencv_stitching -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dnn_superres -lopencv_dpm -lopencv_highgui -lopencv_face -lopencv_freetype -lopencv_fuzzy -lopencv_hfs -lopencv_img_hash -lopencv_line_descriptor -lopencv_quality -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_sfm -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_superres -lopencv_optflow -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_dnn -lopencv_plot -lopencv_videostab -lopencv_videoio -lopencv_xfeatures2d -lopencv_shape -lopencv_ml -lopencv_ximgproc -lopencv_video -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core Since you want to use OpenCV library in your project and want to know all the flags to pass to compiler, you need to do pkg-config -cflags -libs opencv4
#Download opencv python for mac install
To install it, use brew install pkg-config Pkg-config is a very handy tool to ask for package information to use in your projects. It will install all dependencies on the fly as well. Then the easiest way to install OpenCV libary is brew install opencv Install OpenCV on macOSīecause you are a macOS user, you probably already use homebrew for package management.

If you are interested in using OpenCV in your Xcode project, the following steps might help you. Developers using macOS as their primary operating system may use Xcode IDE since it is a key development environment to creating applications for Apple products. OpenCV is one of the best if not the best computer vision library to use and therefore, many people with various backgrounds get their hands dirty trying it out.
