Skip to content

build command

Compile the currently downloaded llama.cpp

INFO

If the build fails on macOS with the error "/usr/bin/cc" is not able to compile a simple test program, try running xcode-select --install to install the Xcode command line tools.

Usage

shell
npx --no node-llama-cpp build
npx --no node-llama-cpp build

Options

Option Description
-a [string], --arch [string] The architecture to compile llama.cpp for (string)
-t [string], --nodeTarget [string] The Node.js version to compile llama.cpp for. Example: v18.0.0 (string)
--metal Compile llama.cpp with Metal support. Enabled by default on macOS. Can be disabled with "--no-metal". Can also be set via the NODE_LLAMA_CPP_METAL environment variable (default: true) (boolean)
--cuda Compile llama.cpp with CUDA support. Can also be set via the NODE_LLAMA_CPP_CUDA environment variable (default: false) (boolean)
-h, --help Show help
-v, --version Show version number

To set custom cmake options that are supported by llama.cpp's cmake build, set an environment variable of the option prefixed with NODE_LLAMA_CPP_CMAKE_OPTION_.