Skip to content

Instantly share code, notes, and snippets.

@roz3x
Last active May 12, 2024 17:34
Show Gist options
  • Save roz3x/5088b370b1288e13fc6b61a75f21da4c to your computer and use it in GitHub Desktop.
Save roz3x/5088b370b1288e13fc6b61a75f21da4c to your computer and use it in GitHub Desktop.
zig compile on Mac M1
#!/bin/sh
# make sure you have homebrew already installed
brew installed llvm
git clone https://github.com/ziglang/zig.git
cd zig
mkdir -p build
cd build
# for fast build
cmake .. -DCMAKE_PREFIX_PATH="$(brew --prefix llvm);$(brew --prefix zstd)"; make -j12; make install
# for optimized build
cmake .. -DCMAKE_PREFIX_PATH="$(brew --prefix llvm);$(brew --prefix zstd)" -DZIG_STATIC_LLVM=on -DZIG_NO_LIB=ON -DCMAKE_BUILD_TYPE=Release; make -j12; make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment