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: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)
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: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.
- 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
Pull Requests
Commit Messages
The commit message title should follow this format:- 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…”
Tests
Please include tests with your pull request. Strive to test behavior, not implementation. Run tests with:Using synctest (Go 1.24+)
Using synctest (Go 1.24+)
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:To enable synctest for all Go commands:
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
Platform-Specific Development
- macOS
- Windows
- Linux
- Docker
Running Tests
To run tests, usego test:
Library Detection
Ollama looks for acceleration libraries in the following paths relative to theollama 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