📺 OpenCV C++ Mac M1 Installation Tutorial Video
We need homebrew installed in our system
brew install cmake
mkdir Open_CV && cd Open_CV
git clone https://github.com/opencv/opencv.git
mkdir build && cd build
cmake ../opencv/ .
arch -arm64 cmake ../opencv/ -DWITH_QT=OFF -DWITH_OPENGL=OFF -DFORCE_VTK=OFF -DWITH_TBB=OFF -DWITH_GDAL=OFF -DWITH_XINE=OFF -DBUILD_EXAMPLES=OFF -DBUILD_ZLIB=OFF -DBUILD_TESTS=OFF .
arch -arm64 sudo make -j 4
arch -arm64 sudo make install
I was dealing with this issue last night and I found that I only had cmake installed for x86_64, though
which cmake
did not specify that. Instead, it was that my Homebrew version was installed on the x86_64 path rather than the arm64 path.One of Homebrew's pages specifies that Intel files are installed under /usr/local, while Apple Silicon files are installed under /opt/homebrew, and is chosen automatically on install.
Since I had previously checked the box "Run with rosetta" in my terminal settings, I believe Homebrew installed as if it were an Intel machine rather than an Apple Silicon machine. I reran the Homebrew install with the box unchecked, added Homebrew to my path, and reinstalled cmake, which then allowed me to run the arch command without the above error.