table of Contents
Xcode Command Line
Installation Tools
Two options:
Direct download Xcode in the AppStore
Installation using the command line:
xcode-select --install
Xcode license certificate
sudo xcodebuild -license
Will be asked to read the license, turn to the last page, then agreed.
MacPorts installation
MacPorts official website Download: Download
Note: The longer the time to install pkg files, you may need to install multiple times (if the installation is unsuccessful)
Configuration environment variable
edit:
vim ~/.bash_profile
Add the following two lines:
export PATH=/opt/local/bin:$PATH export PATH=/opt/local/sbin:$PATH
Validate the configuration:
source .bash_profile
Installation OpenCV
Install OpenCV + java
sudo port selfupdate
sudo port clean db48
sudo port install db48
sudo port install opencv +java
Process is:
- Update MacPorts
- Remove and reinstall db48 (which may cause the installation to fail)
- Install OpenCV + java
Installation Qualification
port contents opencv | grep java
The following information represents the emergence of a successful installation:
/opt/local/share/OpenCV/java/libopencv_java(数字取决于版本号).dylib
/opt/local/share/OpenCV/java/opencv-(数字取决于版本号).jar
Idea Configuration
Import
jar
packages:Update VM configuration:
Additional questions may arise
If jdk version is too low, it may lead directly translated version fails at compile time, because later OpenCV uses jdk12. If there is such a situation, directly in Oracle's official website to download jdk12 then be configured in the idea of: