Installing cmake with home-brew
Typing brew install cmake
as you did installs cmake
. Now you can type cmake
and use it.
If typing cmake
doesn’t work make sure /usr/local/bin
is your PATH
. You can see it with echo $PATH
. If you don’t see /usr/local/bin
in it add the following to your ~/.bashrc
:
export PATH="/usr/local/bin:$PATH"
Then reload your shell session and try again.
(all the above assumes Homebrew is installed in its default location, /usr/local
. If not you’ll have to replace /usr/local
with $(brew --prefix)
in the export
line)
Download the latest CMake Mac binary distribution here: https://cmake.org/download/ (current latest is: https://cmake.org/files/v3.17/cmake-3.17.1-Darwin-x86_64.dmg)
Double click the downloaded .dmg file to install it. In the window that pops up, drag the CMake icon into the Application folder.
Add this line to your .bashrc file:
PATH="/Applications/CMake.app/Contents/bin":"$PATH"
Reload your .bashrc file:
source ~/.bashrc
Verify the latest cmake version is installed:
cmake --version
You can launch the CMake GUI by clicking on LaunchPad and typing cmake. Click on the CMake icon that appears.
On MacBooks with M1 processor:
Install:
arch -arm64 brew install cmake
Upgrade:
arch -arm64 brew upgrade cmake