Skip to main content
Thank you for your interest in contributing to Ollama! This guide will help you get started with contributing to the project.

Getting Started

Before you start contributing, you’ll need to set up your development environment.

Development Setup

See the development documentation for instructions on how to build and run Ollama locally

Prerequisites

To build Ollama from source, you’ll need:
  • Go
  • C/C++ Compiler:
    • macOS: Clang (included with Xcode)
    • Windows: TDM-GCC (amd64) or llvm-mingw (arm64)
    • Linux: GCC or Clang

Quick Start

From the root directory of the repository:
go run . serve
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.

Types of Contributions

Ideal Issues

These types of contributions are most likely to be accepted:

Bug Fixes

Issues where Ollama stops working or results in an unexpected error

Performance

Improvements to make Ollama faster at model inference, downloading, or uploading

Security

Issues that could lead to a security vulnerability (see SECURITY.md)
For security vulnerabilities, do not disclose publicly. Please email hello@ollama.com instead.
Browse open issues:

Harder to Review

These contributions are important but may take longer to review and merge:
  • New features: New features (e.g., API fields, environment variables) add surface area to Ollama and make it harder to maintain in the long run as they cannot be removed without potentially breaking users in the future
  • Refactoring: Large code improvements are important, but can be harder or take longer to review and merge
  • Documentation: Small updates to fill in or correct missing documentation are helpful, however large documentation additions can be hard to maintain over time

May Not Be Accepted

The following types of changes are unlikely to be accepted:
  • Changes that break backwards compatibility in Ollama’s API (including the OpenAI-compatible API)
  • Changes that add significant friction to the user experience
  • Changes that create a large future maintenance burden for maintainers and contributors

Proposing a Non-Trivial Change

By “non-trivial”, we mean a change that is not a bug fix or small documentation update. If you are unsure, please ask us on our Discord server.
Before opening a non-trivial Pull Request, please open an issue first to discuss the change and get feedback from the maintainers. This helps us:
  • Understand the context of the change
  • Determine how it fits into Ollama’s roadmap
  • Prevent duplicating work
  • Avoid spending time on changes that may not be accepted

Tips for Proposals

1

Explain the problem

Focus on the problem you are trying to solve, not what you are trying to do.
2

Explain why it's important

Help us understand the impact and value of the change.
3

Explain how it will be used

Provide context on the use case and user experience.
4

Explain how it will be tested

Describe your testing approach and any edge cases.
5

Provide draft documentation (bonus)

Show what documentation you would expect to see if the changes were accepted.

Pull Requests

Commit Messages

The commit message title should follow this format:
<package>: <short description>
Guidelines:
  • The package is the most affected Go package
  • If the change does not affect Go code, use the directory name instead
  • Changes to a single well-known file in the root directory may use the file name
  • The short description should start with a lowercase letter
  • Think of it as completing the sentence: “This changes Ollama to…”
llm/backend/mlx: support the llama architecture
CONTRIBUTING: provide clarity on good commit messages, and bad

Tests

Please include tests with your pull request. Strive to test behavior, not implementation. Run tests with:
go test ./...
In rare circumstances, you may need to use the new “synctest” package in Go 1.24.If you see failures in CI but not locally, you may need to enable synctest:
GOEXPERIMENT=synctest go test ./...
To enable synctest for all Go commands:
go env -w GOEXPERIMENT=synctest
The synctest package is not required for production builds.

New Dependencies

Dependencies should be added sparingly. If you are adding a new dependency, please:
  • Explain why it is necessary
  • Describe what other approaches you attempted that did not work without it

Development Workflow

1

Fork and clone

Fork the repository on GitHub and clone it locally:
git clone https://github.com/YOUR_USERNAME/ollama.git
cd ollama
2

Create a branch

Create a new branch for your work:
git checkout -b my-feature-branch
3

Make changes

Make your changes and test them thoroughly:
go run . serve
go test ./...
4

Commit changes

Commit your changes with a clear commit message:
git add .
git commit -m "package: description of changes"
5

Push and create PR

Push your branch and create a pull request:
git push origin my-feature-branch
Then open a pull request on GitHub.

Platform-Specific Development

macOS (Apple Silicon)

macOS Apple Silicon supports Metal which is built-in to the Ollama binary. No additional steps are required.
go run . serve

macOS (Intel)

Install CMake:
brew install cmake
Configure and build:
cmake -B build
cmake --build build
go run . serve

Running Tests

To run tests, use go test:
go test ./...
For specific packages:
go test ./llm/...
With verbose output:
go test -v ./...

Library Detection

Ollama looks for acceleration libraries in the following paths relative to the ollama executable:
  • ./lib/ollama (Windows)
  • ../lib/ollama (Linux)
  • . (macOS)
  • build/lib/ollama (for development)
If the libraries are not found, Ollama will not run with any acceleration libraries.

Need Help?

Discord Community

Join our Discord server for questions and discussions

GitHub Discussions

Browse and participate in GitHub discussions

Development Guide

Read the full development documentation

Report Issues

Report bugs and request features
If you need help with anything, feel free to reach out to us on our Discord server.