Stockfish Development Setup
Installing a compiler
- Download the installer
In the MSYS2 Installer change the installation folder to:
URTC64 Shell run:
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain
Download LLVM 17
Run the executable and in the installer choose:
Add LLVM to the system PATH for current user
There's a much higher quality version of this available on our Discord.
More in depth information about various compilers can be found here.
Installing a compiler
On Unix-like systems you will most likely have all the tools installed,
which are required to build Stockfish. Expect
clang-format which we use to format our codebase.
sudo apt install build-essential git
sudo apt install clang-format-17
Installing a compiler
On MacOS you will need to install the Xcode Command Line Tools.
It is enough to run the following command in your terminal, instead of installing the full Xcode.
sudo xcode-select --install
brew install clang-format@17
Participating in the project
Stockfish's improvement over the last decade has been a great community effort. Nowadays most development talk takes place on Discord.
There are many ways to contribute to Stockfish:
If you want to contribute to Stockfish directly, you can do so in a couple of ways.
Follow the steps described in our Fishtest wiki to create your first test.
It is advised to first follow the development setup steps for your platform
New commits to stockfish can mostly be categorised in 2 categories:
Non functional changes
These are changes that don't change the search behaviour and can be directly submitted as pull requests.
These change the search behaviour and lead to a different search tree.
Every functional patch (commit) has to be verified by Fishtest, our testing framework.
NNUE Pytorch is the trainer for Stockfish's neural network.
Usually changes here are tested by training a new network and testing it against the current network via Fishtest.
Using Stockfish in your own project
Stockfish is a UCI chess engine, but what does that mean? It means that Stockfish follows the UCI protocol, which you find explained here in great detail. This is the usual way of communicating with Stockfish, so you do not need to write any C++!
Your next step is probably gonna be researching how you can open an executable in your programming language. You will need to write to
stdin and listen to
stdout, that is where Stockfish's output will end up.
- Python: https://python-chess.readthedocs.io/en/latest/engine.html
- NodeJS: You can follow this guide on how to communicate with a program.
- C++: You can try out this wrapper for process communication.
- Rust: Examine the documentation on how to spawn a Command.
I want Stockfish to comment on the move it made, what do I need to do?
That is not possible. You will have to write your own logic to create such a feature.
I want to get an evaluation of the current position.
While Stockfish has an
eval command, it only statically evaluates positions without performing any search. A more precise evaluation is available after you use the
go command together with a specified limit.
Stockfish is free and distributed under the GNU General Public License version 3 (GPL v3). Essentially, this means you are free to do almost exactly what you want with the program, including distributing it among your friends, making it available for download from your website, selling it (either by itself or as part of some bigger software package), or using it as the starting point for a software project of your own. This also means that you can distribute Stockfish alongside your proprietary system, but to do this validly, you must make sure that Stockfish and your program communicate at arm's length, that they are not combined in a way that would make them effectively a single program.
The only real limitation is that whenever you distribute Stockfish in some way, you MUST always include the license and the full source code (or a pointer to where the source code can be found) to generate the exact binary you are distributing. If you make any changes to the source code, these changes must also be made available under GPL v3.
Place the following file into
.git/hooks/pre-push and make it executable.
chmod +x .git/hooks/pre-push. This will prevent you from pushing commits that do not contain a Bench or 'No functional change' in the commit message.
Only really useful for maintainers.
while read local_ref local_sha remote_ref remote_sha; do
if [[ "$remote_ref" == "refs/heads/master" ]]; then
# Iterate through commits
for commit in $(git rev-list --no-merges $remote_sha..$local_sha); do
# Get the commit message
commit_msg=$(git log --format=%B -n 1 $commit)
# Check for the bench regex
if echo "$commit_msg" | grep -m 1 -o -x -E "$bench_regex" >/dev/null; then
# Check for the "No functional change" regex
if echo "$commit_msg" | grep -o -x -E "$no_functional_change_regex" >/dev/null; then
echo "Commit $commit does not contain a Bench or 'No functional change'"