108

I'm new to programming. Can you please help me install cmake? I typed brew install cmake. What should I do next?

2
  • 3
    that should do the job, you already ran the command to install it. Commented Aug 24, 2015 at 15:00
  • after install run command like this "./{{output_app_file}}"
    – Bruno
    Commented Dec 2, 2018 at 23:55

3 Answers 3

180

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)

0
64
  1. 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)

  2. Double click the downloaded .dmg file to install it. In the window that pops up, drag the CMake icon into the Application folder.

  3. Add this line to your .bashrc file: PATH="/Applications/CMake.app/Contents/bin":"$PATH"

  4. Reload your .bashrc file: source ~/.bashrc

  5. Verify the latest cmake version is installed: cmake --version

  6. You can launch the CMake GUI by clicking on LaunchPad and typing cmake. Click on the CMake icon that appears.

2
  • 3
    This should be marked as the correct answer. Worked perfectly. Thanks. Commented Feb 4, 2019 at 18:40
  • 9
    While this works, this is not the correct answer because it doesn’t use Homebrew- which OP explicitely mentioned. Also, the downside of this method is you have to upgrade cmake by yourself instead of having it for free with brew upgrade.
    – bfontaine
    Commented Apr 17, 2020 at 13:51
30

On MacBooks with M1 processor:

Install:

arch -arm64 brew install cmake

Upgrade:

arch -arm64 brew upgrade cmake
1
  • 4
    A great update for Apple M1 users. Thank you.
    – Alexis
    Commented May 6, 2022 at 22:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.