1 Mac OS X Build Instructions and Notes
2 ====================================
3 This guide will show you how to build bitcoind(headless client) for OSX.
8 * See [readme-qt.md](readme-qt.md) for instructions on building Bitcoin-Qt, the
9 graphical user interface.
10 * Tested on OS X 10.5 through 10.8 on Intel processors only. PPC is not
11 supported because it is big-endian.
12 * All of the commands should be executed in a Terminal application. The
13 built-in one is located in `/Applications/Utilities`.
18 You need to install XCode with all the options checked so that the compiler
19 and everything is available in /usr not just /Developer. XCode should be
20 available on your OS X installation media, but if not, you can get the
21 current version from https://developer.apple.com/xcode/. If you install
22 Xcode 4.3 or later, you'll need to install its command line tools. This can
23 be done in `Xcode > Preferences > Downloads > Components` and generally must
24 be re-done or updated every time Xcode is updated.
26 There's an assumption that you already have `git` installed, as well. If
27 not, it's the path of least resistance to install [Github for Mac](https://mac.github.com/)
29 [Git for OS X](https://code.google.com/p/git-osx-installer/). It is also
30 available via Homebrew or MacPorts.
32 You will also need to install [Homebrew](http://mxcl.github.io/homebrew/)
33 or [MacPorts](https://www.macports.org/) in order to install library
34 dependencies. It's largely a religious decision which to choose, but, as of
35 December 2012, MacPorts is a little easier because you can just install the
36 dependencies immediately - no other work required. If you're unsure, read
37 the instructions through first in order to assess what you want to do.
38 Homebrew is a little more popular among those newer to OS X.
40 The installation of the actual dependencies is covered in the Instructions
43 Instructions: MacPorts
44 ----------------------
46 ### Install dependencies
48 Installing the dependencies using MacPorts is very straightforward.
50 sudo port install boost db48@+no_java openssl miniupnpc
52 ### Building `bitcoind`
54 1. Clone the github tree to get the source code and go into the directory.
64 3. It is a good idea to build and run the unit tests, too:
66 make -f makefile.osx test
68 Instructions: HomeBrew
69 ----------------------
71 #### Install dependencies using Homebrew
73 brew install boost miniupnpc openssl berkeley-db4
75 Note: After you have installed the dependencies, you should check that the Brew installed version of OpenSSL is the one available for compilation. You can check this by typing
79 into Terminal. You should see OpenSSL 1.0.1e 11 Feb 2013.
81 If not, you can ensure that the Brew OpenSSL is correctly linked by running
83 brew link openssl --force
85 Rerunning "openssl version" should now return the correct version.
87 ### Building `bitcoind`
89 1. Clone the github tree to get the source code and go into the directory.
94 2. Modify source in order to pick up the `openssl` library.
96 Edit `makefile.osx` to account for library location differences. There's a
97 diff in `contrib/homebrew/makefile.osx.patch` that shows what you need to
98 change, or you can just patch by doing
100 patch -p1 < contrib/homebrew/makefile.osx.patch
107 4. It is a good idea to build and run the unit tests, too:
109 make -f makefile.osx test
111 Creating a release build
112 ------------------------
114 A bitcoind binary is not included in the Bitcoin-Qt.app bundle. You can ignore
115 this section if you are building `bitcoind` for your own use.
117 If you are building `bitcoind` for others, your build machine should be set up
118 as follows for maximum compatibility:
120 All dependencies should be compiled with these flags:
122 -mmacosx-version-min=10.5 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk
124 For MacPorts, that means editing your macports.conf and setting
125 `macosx_deployment_target` and `build_arch`:
127 macosx_deployment_target=10.5
130 ... and then uninstalling and re-installing, or simply rebuilding, all ports.
132 As of December 2012, the `boost` port does not obey `macosx_deployment_target`.
133 Download `http://gavinandresen-bitcoin.s3.amazonaws.com/boost_macports_fix.zip`
134 for a fix. Some ports also seem to obey either `build_arch` or
135 `macosx_deployment_target`, but not both at the same time. For example, building
136 on an OS X 10.6 64-bit machine fails. Official release builds of Bitcoin-Qt are
137 compiled on an OS X 10.6 32-bit machine to workaround that problem.
139 Once dependencies are compiled, creating `Bitcoin-Qt.app` is easy:
141 make -f Makefile.osx RELEASE=1
146 It's now available at `./bitcoind`, provided that you are still in the `src`
147 directory. We have to first create the RPC configuration file, though.
149 Run `./bitcoind` to get the filename where it should be put, or just try these
152 echo -e "rpcuser=bitcoinrpc\nrpcpassword=$(xxd -l 16 -p /dev/urandom)" > "/Users/${USER}/Library/Application Support/Bitcoin/bitcoin.conf"
153 chmod 600 "/Users/${USER}/Library/Application Support/Bitcoin/bitcoin.conf"
155 When next you run it, it will start downloading the blockchain, but it won't
156 output anything while it's doing this. This process may take several hours.
160 ./bitcoind --help # for a list of command-line options.
161 ./bitcoind -daemon # to start the bitcoin daemon.
162 ./bitcoind help # When the daemon is running, to get a list of RPC commands