]> Git Repo - VerusCoin.git/blob - doc/build-osx.md
win32: add version info to bitcoind.exe
[VerusCoin.git] / doc / build-osx.md
1 Mac OS X Build Instructions and Notes
2 ====================================
3 This guide will show you how to build bitcoind(headless client) for OSX.
4
5 Notes
6 -----
7
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`.
14
15 Preparation
16 -----------
17
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.
25
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/)
28 (OS X 10.7+) or
29 [Git for OS X](https://code.google.com/p/git-osx-installer/). It is also
30 available via Homebrew or MacPorts.
31
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.
39
40 The installation of the actual dependencies is covered in the Instructions
41 sections below.
42
43 Instructions: MacPorts
44 ----------------------
45
46 ### Install dependencies
47
48 Installing the dependencies using MacPorts is very straightforward.
49
50     sudo port install boost db48@+no_java openssl miniupnpc
51
52 ### Building `bitcoind`
53
54 1. Clone the github tree to get the source code and go into the directory.
55
56         git clone [email protected]:bitcoin/bitcoin.git bitcoin
57         cd bitcoin
58
59 2.  Build bitcoind:
60
61         cd src
62         make -f makefile.osx
63
64 3.  It is a good idea to build and run the unit tests, too:
65
66         make -f makefile.osx test
67
68 Instructions: HomeBrew
69 ----------------------
70
71 #### Install dependencies using Homebrew
72
73         brew install boost miniupnpc openssl berkeley-db4
74
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
76
77         openssl version
78
79 into Terminal. You should see OpenSSL 1.0.1e 11 Feb 2013.
80
81 If not, you can ensure that the Brew OpenSSL is correctly linked by running
82
83         brew link openssl --force
84
85 Rerunning "openssl version" should now return the correct version.
86
87 ### Building `bitcoind`
88
89 1. Clone the github tree to get the source code and go into the directory.
90
91         git clone [email protected]:bitcoin/bitcoin.git bitcoin
92         cd bitcoin
93
94 2.  Modify source in order to pick up the `openssl` library.
95
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
99
100         patch -p1 < contrib/homebrew/makefile.osx.patch
101
102 3.  Build bitcoind:
103
104         cd src
105         make -f makefile.osx
106
107 4.  It is a good idea to build and run the unit tests, too:
108
109         make -f makefile.osx test
110
111 Creating a release build
112 ------------------------
113
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.
116
117 If you are building `bitcoind` for others, your build machine should be set up
118 as follows for maximum compatibility:
119
120 All dependencies should be compiled with these flags:
121
122     -mmacosx-version-min=10.5 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk
123
124 For MacPorts, that means editing your macports.conf and setting
125 `macosx_deployment_target` and `build_arch`:
126
127     macosx_deployment_target=10.5
128     build_arch=i386
129
130 ... and then uninstalling and re-installing, or simply rebuilding, all ports.
131
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.
138
139 Once dependencies are compiled, creating `Bitcoin-Qt.app` is easy:
140
141     make -f Makefile.osx RELEASE=1
142
143 Running
144 -------
145
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.
148
149 Run `./bitcoind` to get the filename where it should be put, or just try these
150 commands:
151
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"
154
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.
157
158 Other commands:
159
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
This page took 0.030784 seconds and 4 git commands to generate.