Installation¶
llama-crab is distributed on crates.io
and is also buildable from a Git checkout. The default features compile
the CPU (OpenMP) and — on Apple Silicon — Metal backends, so most users
can add the dependency and start building.
1. Add the dependency¶
Pin the llama.cpp version
The crate pins llama.cpp to a specific commit, so two builds of
the same llama-crab version always produce the same native
library. You can see the pinned commit on the README badge or
through cargo tree -p llama-crab-sys.
2. Pick a backend¶
The default features give you a working binary on the most common platforms, but you almost always want to be explicit:
See the Cargo features reference for the complete list of features and what each one toggles.
3. System requirements¶
The build script compiles llama.cpp from source. Make sure the
following are available before running cargo build:
First build is slow
Compiling every llama.cpp backend takes ~3 minutes on a 16-core machine the first time. Subsequent builds are cached. To cut the cold build, disable the backends you don't need — see step 2.
4. Verify the toolchain¶
After the install, run a quick cargo build to make sure CMake, the
compiler and the C++ standard library are all reachable:
cargo new hello-crab --bin
cd hello-crab
# Add the dependency shown in step 1, then:
cargo build --release
A successful build prints something like:
Compiling llama-crab-sys v0.1.300 (...)
Compiling llama-crab v0.1.300 (...)
Finished `release` profile [optimized] [..]
You're ready to write your first program.
Optional: download a model¶
The rest of the guide assumes you have a GGUF file on disk. The easiest way to grab a known-good one is the helper script:
See scripts/download_models.sh
for the full list of supported targets.
Next steps¶
- Walk through Your first program — a 50-line
main.rsthat exercises the most common paths. - Skim the Cargo features reference to know what's enabled by default and what to toggle for your target.
- Jump straight to a feature guide that matches what you want to build.