Building quick-lint-js on macOS from source
On macOS, you can build quick-lint-js using one of the following build systems:
- CMake & Ninja with Xcode CLI tools (recommended)
- CMake & Ninja with Homebrew Clang/LLVM (recommended)
- CMake & Xcode IDE
- Nix (Nix users only)
- Single-command build (not recommended)
Building with Homebrew CMake, Ninja, and Clang/LLVM
0. Install Homebrew packages
Install LLVM, CMake, and Ninja using Homebrew by running the following command:
brew install cmake llvm ninja
1. Configure with CMake
Run the following command to use Homebrew’s version of LLVM and create
a directory called build
:
PATH="$(brew --prefix)/opt/llvm/bin:$PATH" \ CC=clang \ CXX=clang++ \ CPPFLAGS="-I$(brew --prefix)/opt/llvm/include" \ CXXFLAGS=-D_LIBCPP_DISABLE_AVAILABILITY \ LDFLAGS="-L$(brew --prefix)/opt/llvm/lib -L$(brew --prefix)/opt/llvm/lib/c++" \ cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_BUILD_TYPE=Debug -S . -B build
2. Build
Run the following command to build the quick-lint-js executable, quick-lint-js’ tests, and quick-lint-js’ benchmarks:
ninja -C build
If you only want to build the quick-lint-js executable:
ninja -C build quick-lint-js
If you only want to build quick-lint-js’ tests:
ninja -C build quick-lint-js-test
3. Run
Run the following command to run quick-lint-js’ test suite:
./build/test/quick-lint-js-test
If you want to run the quick-lint-js program:
./build/quick-lint-js --help