Build Osx
Build Osx
This guide describes how to build bitcoind, command-line utilities, and GUI on
macOS
## Dependencies
Library | Purpose |
Description
-----------------------------------------------------------|------------|----------
------------
[automake](https://formulae.brew.sh/formula/automake) | Build | Generate
makefile
[libtool](https://formulae.brew.sh/formula/libtool) | Build | Shared
library support
[pkg-config](https://formulae.brew.sh/formula/pkg-config) | Build | Configure
compiler and linker flags
[boost](https://formulae.brew.sh/formula/boost) | Utility | Library
for threading, data structures, etc
[libevent](https://formulae.brew.sh/formula/libevent) | Networking | OS
independent asynchronous networking
Library | Purpose
| Description
---------------------------------------------------------------
|------------------|----------------------
[berkeley-db@4](https://formulae.brew.sh/formula/berkeley-db@4) | Berkeley DB
| Wallet storage (only needed when wallet enabled)
[qt@5](https://formulae.brew.sh/formula/qt@5) | GUI
| GUI toolkit (only needed when GUI enabled)
[qrencode](https://formulae.brew.sh/formula/qrencode) | QR codes in GUI
| Generating QR codes (only needed when GUI enabled)
[zeromq](https://formulae.brew.sh/formula/zeromq) | ZMQ notification
| Allows generating ZMQ notifications (requires ZMQ version >= 4.0.0)
[sqlite](https://formulae.brew.sh/formula/sqlite) | SQLite DB
| Wallet storage (only needed when wallet enabled)
[miniupnpc](https://formulae.brew.sh/formula/miniupnpc) | UPnP Support
| Firewall-jumping support (needed for port mapping support)
[libnatpmp](https://formulae.brew.sh/formula/libnatpmp) | NAT-PMP Support
| Firewall-jumping support (needed for port mapping support)
[python3](https://formulae.brew.sh/formula/[email protected]) | Testing
| Python Interpreter (only needed when running the test suite)
Library | Purpose |
Description
----------------------------------------------------|------------------|-----------
-----------
[librsvg](https://formulae.brew.sh/formula/librsvg) | Deploy Dependency| Library to
render SVG files
[ds_store](https://pypi.org/project/ds-store/) | Deploy Dependency| Examine
and modify .DS_Store files
[mac_alias](https://pypi.org/project/mac-alias/) | Deploy Dependency|
Generate/Read binary alias and bookmark records
## Preparation
```
/Applications/Utilities/Terminal.app
```
The Xcode Command Line Tools are a collection of build tools for macOS.
These tools must be installed in order to build Bitcoin Core from source.
``` bash
xcode-select --install
```
Homebrew is a package manager for macOS that allows one to install packages from
the command line easily.
While several package managers are available for macOS, this guide will focus on
Homebrew as it is the most popular.
Since the examples in this guide which walk through the installation of a package
will use Homebrew, it is recommended that you install it to follow along.
Otherwise, you can adapt the commands to your package manager of choice.
Note: If you run into issues while installing Homebrew or pulling packages, refer
to [Homebrew's troubleshooting page](https://docs.brew.sh/Troubleshooting).
``` bash
brew install automake libtool boost pkg-config libevent
```
``` bash
git clone https://github.com/bitcoin/bitcoin.git
```
``` bash
brew install berkeley-db@4
```
Note: Apple has included a useable `sqlite` package since macOS 10.14.
You may not need to install this package.
``` bash
brew install sqlite
```
---
###### Qt
``` bash
brew install qt@5
```
Ensure that the `qt@5` package is installed, not the `qt` package.
If 'qt' is installed, the build process will fail.
if installed, remove the `qt` package with the following command:
``` bash
brew uninstall qt
```
Note: Building with Qt binaries downloaded from the Qt website is not officially
supported.
See the notes in [#7714](https://github.com/bitcoin/bitcoin/issues/7714).
###### qrencode
The GUI can encode addresses in a QR Code. To build in QR support for the GUI,
install `qrencode`.
Skip if not using the GUI or don't want QR code functionality.
``` bash
brew install qrencode
```
---
###### miniupnpc
``` bash
brew install miniupnpc
```
###### libnatpmp
``` bash
brew install libnatpmp
```
Note: UPnP and NAT-PMP support will be compiled in and disabled by default.
Check out the [further configuration](#further-configuration) section for more
information.
---
``` bash
brew install zeromq
```
There is an included test suite that is useful for testing code changes when
developing.
To run the test suite (recommended), you will need to have Python 3 installed:
``` bash
brew install python
```
---
You can deploy a `.dmg` containing the Bitcoin Core application using `make
deploy`.
This command depends on a couple of python packages, so it is required that you
have `python` installed.
Ensuring that `python` is installed, you can install the deploy dependencies by
running the following commands in your terminal:
``` bash
brew install librsvg
```
``` bash
pip3 install ds_store mac_alias
```
### 1. Configuration
There are many ways to configure Bitcoin Core, here are a few common examples:
``` bash
./autogen.sh
./configure --with-gui=no
```
This explicitly enables the GUI and disables legacy wallet support.
If `qt` is not installed, this will throw an error.
If `sqlite` is installed then descriptor wallet functionality will be built.
If `sqlite` is not installed, then wallet functionality will be disabled.
``` bash
./autogen.sh
./configure --without-bdb --with-gui=yes
```
``` bash
./autogen.sh
./configure --without-wallet --with-gui=no
```
You may want to dig deeper into the configuration options to achieve your desired
behavior.
Examine the output of the following command for a full list of configuration
options:
``` bash
./configure -help
```
### 2. Compile
``` bash
make # use "-j N" here for N parallel jobs
make check # Run tests if Python 3 is available
```
You can also create a `.dmg` containing the `.app` bundle by running the following
command:
``` bash
make deploy
```
The first time you run `bitcoind` or `bitcoin-qt`, it will start downloading the
blockchain.
This process could take many hours, or even days on slower than average systems.
``` bash
/Users/${USER}/Library/Application Support/Bitcoin/
```
```shell
mkdir -p "/Users/${USER}/Library/Application Support/Bitcoin"
You can monitor the download process by looking at the debug.log file:
```shell
tail -f $HOME/Library/Application\ Support/Bitcoin/debug.log
```
## Other commands:
```shell
./src/bitcoind -daemon # Starts the bitcoin daemon.
./src/bitcoin-cli --help # Outputs a list of command-line options.
./src/bitcoin-cli help # Outputs a list of RPC commands when the daemon is
running.
./src/qt/bitcoin-qt -server # Starts the bitcoin-qt server mode, allows bitcoin-cli
control
```