Skip to content

Instantly share code, notes, and snippets.

@loradd
Last active January 1, 2026 21:34
Show Gist options
  • Select an option

  • Save loradd/73b5f13450b886a810280f3a6e86a5bd to your computer and use it in GitHub Desktop.

Select an option

Save loradd/73b5f13450b886a810280f3a6e86a5bd to your computer and use it in GitHub Desktop.
LLVM Installation on MacOS Mojave using Homebrew

Installing LLVM on MacOS Mojave using Homebrew

This guide illustrates the steps required to install the latest version of LLVM on MacOS Mojave using Homebrew.

1) Install Homebrew In order to install Homebrew, simply open a terminal instance and paste the following command:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2) Install LLVM The latest version of LLVM can be installed running the following command in the terminal:

brew install llvm

Once completed the installation, add LLVM to your path variable running the following command:

echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.zshrc  # (zsh)
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.bashrc # (bash)

3) Environment Variables In order to use build tools such as CMake or Make, specific environment variables must be properly updated targeting the new LLVM installation. Add the following assignments to your configuration file (.bashrc or .zshrc):

export CC=clang
export CXX=clang++
export LD=ld.lld
export AR=llvm-ar
export RANLIB=llvm-ranlib

4) Building LLVM projects LLVM projects can be compiled executing the following command from the root directory:

clang++ -g -O3 <<APP_CPP_FILE>> `llvm-config --cxxflags --ldflags --system-libs --libs core` -o <<APP_EXECUTABLE_NAME>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment