Documentation Index
Fetch the complete documentation index at: https://docs.ollama.com/llms.txt
Use this file to discover all available pages before exploring further.
Development
Install prerequisites:- Go
- CMake 3.24 or newer
- C/C++ compiler: Clang on macOS, Visual Studio 2022 C++ tools on Windows, or GCC/Clang on Linux
- Ninja in
PATHis recommended, especially on Windows
[!NOTE]
Ollama includes native code compiled with CGO. From time to time these data structures can change and CGO can get out of sync resulting in unexpected crashes. You can force a full build of the native code by running go clean -cache first.
Native build model
For a fresh checkout, or after changing native code, build from the repository root. On macOS arm64, this builds Metal inference. On all other platforms this builds CPU-only inference. It builds the Go binary at the repository root and installs the native runtime payload underbuild/lib/ollama.
cuda_v12, cuda_v13, rocm_v7_1, rocm_v7_2, vulkan, cuda_jetpack5, and cuda_jetpack6.
Use standard CMake architecture overrides to narrow GPU builds for local hardware:
GGML_* values during configure. For example, to build CUDA v12 for Pascal without flash attention kernels:
macOS (Apple Silicon)
Additional prerequisites: MLX Metal requires the Metal toolchain. Install Xcode first, then:Windows
Additional prerequisites:- Visual Studio 2022 including the Native Desktop Workload
- (Optional) AMD GPU support
- (Optional) NVIDIA GPU support
- (Optional) Vulkan GPU support
- Vulkan SDK - useful for AMD/Intel GPUs
- (Optional) MLX engine support
Building for Vulkan requires VULKAN_SDK environment variable: PowerShellCMD
Windows (ARM)
Windows ARM does not support additional acceleration libraries at this time.Linux
Additional prerequisites:- (Optional) AMD GPU support
- (Optional) NVIDIA GPU support
- (Optional) Vulkan GPU support
- Vulkan SDK - useful for AMD/Intel GPUs
- Or install via package manager:
sudo apt install vulkan-sdk(Ubuntu/Debian) orsudo dnf install vulkan-sdk(Fedora/CentOS)
- (Optional) MLX engine support
- CUDA 13+ SDK
- cuDNN 9+
- OpenBLAS/LAPACK:
sudo apt install libopenblas-dev liblapack-dev liblapacke-dev(Ubuntu/Debian)
[!IMPORTANT]
Ensure prerequisites are in PATH before running CMake.
MLX Engine (Optional)
The MLX engine enables running safetensor based models. On macOS arm64, MLX is enabled by default. On other platforms, MLX backends are selected withOLLAMA_MLX_BACKENDS.
CUDA
Requires CUDA 13+ and cuDNN 9+.Local MLX source overrides
To build against a local checkout of MLX and/or MLX-C (useful for development), set environment variables before running CMake:Docker
ROCm
Running tests
To run tests, usego test:
Library detection
Ollama looks for native helper binaries and acceleration libraries in installed and local development layouts:../lib/ollamafor standard installs whereollamais underbin/./lib/ollamafor Windows release-style payloads and local dist output.for macOS release artifacts that colocate helpers withollamabuild/lib/ollamaanddist/<platform>/lib/ollamafor local development builds

