You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build-osx.md 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. Mac OS X Build Instructions and Notes
  2. ====================================
  3. The commands in this guide should be executed in a Terminal application.
  4. The built-in one is located in `/Applications/Utilities/Terminal.app`.
  5. Preparation
  6. -----------
  7. Install the OS X command line tools:
  8. `xcode-select --install`
  9. When the popup appears, click `Install`.
  10. Then install [Homebrew](https://brew.sh).
  11. Dependencies
  12. ----------------------
  13. brew install automake berkeley-db4 libtool boost miniupnpc openssl pkg-config protobuf python3 qt libevent
  14. See [dependencies.md](dependencies.md) for a complete overview.
  15. If you want to build the disk image with `make deploy` (.dmg / optional), you need RSVG
  16. brew install librsvg
  17. NOTE: Building with Qt4 is still supported, however, could result in a broken UI. Building with Qt5 is recommended.
  18. Berkeley DB
  19. -----------
  20. It is recommended to use Berkeley DB 4.8. If you have to build it yourself,
  21. you can use [the installation script included in contrib/](/contrib/install_db4.sh)
  22. like so
  23. ```shell
  24. ./contrib/install_db4.sh .
  25. ```
  26. from the root of the repository.
  27. **Note**: You only need Berkeley DB if the wallet is enabled (see the section *Disable-Wallet mode* below).
  28. Build Bitcoin Core
  29. ------------------------
  30. 1. Clone the bitcoin source code and cd into `bitcoin`
  31. git clone https://github.com/bitcoin/bitcoin
  32. cd bitcoin
  33. 2. Build bitcoin-core:
  34. Configure and build the headless bitcoin binaries as well as the GUI (if Qt is found).
  35. You can disable the GUI build by passing `--without-gui` to configure.
  36. ./autogen.sh
  37. ./configure
  38. make
  39. 3. It is recommended to build and run the unit tests:
  40. make check
  41. 4. You can also create a .dmg that contains the .app bundle (optional):
  42. make deploy
  43. Running
  44. -------
  45. Bitcoin Core is now available at `./src/bitcoind`
  46. Before running, it's recommended you create an RPC configuration file.
  47. echo -e "rpcuser=bitcoinrpc\nrpcpassword=$(xxd -l 16 -p /dev/urandom)" > "/Users/${USER}/Library/Application Support/Bitcoin/bitcoin.conf"
  48. chmod 600 "/Users/${USER}/Library/Application Support/Bitcoin/bitcoin.conf"
  49. The first time you run bitcoind, it will start downloading the blockchain. This process could take several hours.
  50. You can monitor the download process by looking at the debug.log file:
  51. tail -f $HOME/Library/Application\ Support/Bitcoin/debug.log
  52. Other commands:
  53. -------
  54. ./src/bitcoind -daemon # Starts the bitcoin daemon.
  55. ./src/bitcoin-cli --help # Outputs a list of command-line options.
  56. ./src/bitcoin-cli help # Outputs a list of RPC commands when the daemon is running.
  57. Using Qt Creator as IDE
  58. ------------------------
  59. You can use Qt Creator as an IDE, for bitcoin development.
  60. Download and install the community edition of [Qt Creator](https://www.qt.io/download/).
  61. Uncheck everything except Qt Creator during the installation process.
  62. 1. Make sure you installed everything through Homebrew mentioned above
  63. 2. Do a proper ./configure --enable-debug
  64. 3. In Qt Creator do "New Project" -> Import Project -> Import Existing Project
  65. 4. Enter "bitcoin-qt" as project name, enter src/qt as location
  66. 5. Leave the file selection as it is
  67. 6. Confirm the "summary page"
  68. 7. In the "Projects" tab select "Manage Kits..."
  69. 8. Select the default "Desktop" kit and select "Clang (x86 64bit in /usr/bin)" as compiler
  70. 9. Select LLDB as debugger (you might need to set the path to your installation)
  71. 10. Start debugging with Qt Creator
  72. Notes
  73. -----
  74. * Tested on OS X 10.8 through 10.13 on 64-bit Intel processors only.
  75. * Building with downloaded Qt binaries is not officially supported. See the notes in [#7714](https://github.com/bitcoin/bitcoin/issues/7714)