bitcoin/doc/build-osx.md

117 lines
3.2 KiB
Markdown
Raw Normal View History

2019-06-14 13:50:12 +02:00
# macOS Build Instructions and Notes
The commands in this guide should be executed in a Terminal application.
2019-06-14 13:50:12 +02:00
The built-in one is located in
```
/Applications/Utilities/Terminal.app
```
2019-06-14 13:50:12 +02:00
## Preparation
Install the macOS command line tools:
2019-06-14 13:50:12 +02:00
```shell
xcode-select --install
```
When the popup appears, click `Install`.
Then install [Homebrew](https://brew.sh).
2019-06-14 13:50:12 +02:00
## Dependencies
```shell
brew install automake berkeley-db4 libtool boost miniupnpc pkg-config python qt libevent qrencode
2019-06-14 13:50:12 +02:00
```
If you run into issues, check [Homebrew's troubleshooting page](https://docs.brew.sh/Troubleshooting).
See [dependencies.md](dependencies.md) for a complete overview.
If you want to build the disk image with `make deploy` (.dmg / optional), you need RSVG:
2019-06-14 13:50:12 +02:00
```shell
brew install librsvg
```
2019-06-14 13:50:12 +02:00
## Berkeley DB
It is recommended to use Berkeley DB 4.8. If you have to build it yourself,
2019-06-14 13:50:12 +02:00
you can use [this](/contrib/install_db4.sh) script to install it
like so:
```shell
./contrib/install_db4.sh .
```
from the root of the repository.
**Note**: You only need Berkeley DB if the wallet is enabled (see [*Disable-wallet mode*](/doc/build-osx.md#disable-wallet-mode)).
2019-06-14 13:50:12 +02:00
## Build Bitcoin Core
1. Clone the Bitcoin Core source code:
2019-06-14 13:50:12 +02:00
```shell
git clone https://github.com/bitcoin/bitcoin
cd bitcoin
```
2. Build Bitcoin Core:
Configure and build the headless Bitcoin Core binaries as well as the GUI (if Qt is found).
You can disable the GUI build by passing `--without-gui` to configure.
2019-06-14 13:50:12 +02:00
```shell
./autogen.sh
./configure
make
```
3. It is recommended to build and run the unit tests:
2019-06-14 13:50:12 +02:00
```shell
make check
```
4. You can also create a `.dmg` that contains the `.app` bundle (optional):
```shell
make deploy
```
## `disable-wallet` mode
When the intention is to run only a P2P node without a wallet, Bitcoin Core may be
compiled in `disable-wallet` mode with:
```shell
./configure --disable-wallet
```
In this case there is no dependency on Berkeley DB 4.8.
Mining is also possible in disable-wallet mode using the `getblocktemplate` RPC call.
2019-06-14 13:50:12 +02:00
## Running
Bitcoin Core is now available at `./src/bitcoind`
Before running, you may create an empty configuration file:
2019-06-14 13:50:12 +02:00
```shell
mkdir -p "/Users/${USER}/Library/Application Support/Bitcoin"
2019-06-14 13:50:12 +02:00
touch "/Users/${USER}/Library/Application Support/Bitcoin/bitcoin.conf"
2019-06-14 13:50:12 +02:00
chmod 600 "/Users/${USER}/Library/Application Support/Bitcoin/bitcoin.conf"
```
2019-06-14 13:50:12 +02:00
The first time you run bitcoind, it will start downloading the blockchain. This process could
take many hours, or even days on slower than average systems.
You can monitor the download process by looking at the debug.log file:
2019-06-14 13:50:12 +02:00
```shell
tail -f $HOME/Library/Application\ Support/Bitcoin/debug.log
```
2019-06-14 13:50:12 +02:00
## 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.
```
2019-06-14 13:50:12 +02:00
## Notes
* Tested on OS X 10.12 Sierra through macOS 10.15 Catalina on 64-bit Intel
2019-06-14 13:50:12 +02:00
processors only.
* Building with downloaded Qt binaries is not officially supported. See the notes in [#7714](https://github.com/bitcoin/bitcoin/issues/7714).