Skip to content

Bitcoin Core Build from Source on macOS

Dan Janosik edited this page Dec 8, 2021 · 2 revisions

Adapted from: https://jonatack.github.io/articles/how-to-compile-bitcoin-core-and-run-the-tests

brew install automake berkeley-db4 libtool boost miniupnpc pkg-config python qt libevent qrencode sqlite ccache
git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin/
CFLAGS="-Wno-error=implicit-function-declaration"  ./contrib/install_db4.sh .
git checkout v22.0

export BDB_PREFIX='/Users/danjanosik/Code/bitcoin/bitcoin/db4'
./autogen.sh
./configure BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include"

# compile
make -j "$(($(sysctl -n hw.physicalcpu)+1))"

# run unit tests
make -j "$(($(sysctl -n hw.physicalcpu)+1))" check

# run functional tests
test/functional/test_runner.py -j 60