Instructions on how to install the CMake tool on macOS.
First step should be to unsinstall any previous CMake installation. This step can be skipped if no CMake version was previously installed.
To uninstall any previous CMake installations use the following commands:
sudo find /usr/local/bin -type l -lname '/Applications/CMake.app/*' -delete
sudo rm -rf /Applications/CMake.app
The CMake tool can be obtained here. Copy the link for the package version that you want to install from there.
Get the CMake installer package using the following commands:
mkdir ~/Downloads/CMake
curl --silent --location --retry 3 "https://github.com/Kitware/CMake/releases/download/v3.19.1/cmake-3.19.1-Darwin-x86_64.dmg" --output ~/Downloads/CMake/cmake-Darwin-x86_64.dmg
Mount the image using the following command:
yes | PAGER=cat hdiutil attach -quiet -mountpoint /Volumes/cmake-Darwin-x86_64 ~/Downloads/CMake/cmake-Darwin-x86_64.dmg
Copy the CMake app to the applications folder using the following command:
cp -R /Volumes/cmake-Darwin-x86_64/CMake.app /Applications/
Unmount the image using the following command:
hdiutil detach /Volumes/cmake-Darwin-x86_64
Add the CMake tool to the PATH using the following command:
sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install=/usr/local/bin
Open a new terminal window and check if the CMake tool is installed:
cmake --version
After installing the CMake tool you can remove the downloaded installation image using the following command:
rm -rf ~/Downloads/CMake