First, install Xcode Command Line Tools. Open a terminal and type:
xcode-select --install
Now install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install Clang and CMake with Homebrew:
brew install llvm cmake
Check your installation with the following commands (press enter after each one and check the output):
clang --version
cmake --version
lldb --version
git --version
At time of writing, Apple's XCode is not based on the latest llvm version 22, but my code requires version 22 or later. You've installed Clang via Homebrew, but make sure the output of "clang --version" is something like, "Homebrew clang version xxx," not "Apple clang version xxx." If yours reports an Apple Clang version, copy this command into your terminal:
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc
Restart your terminal and check again.