1- Copyright (c) 2010 Laszlo Hanyecz
2- Portions Copyright (c) 2011 Douglas Huff
1+ Copyright (c) 2011 Bitcoin Developers
32Distributed under the MIT/X11 software license, see the accompanying file
43license.txt or http://www.opensource.org/licenses/mit-license.php. This
54product includes software developed by the OpenSSL Project for use in the
@@ -26,163 +25,29 @@ everything is available in /usr not just /Developer I think it comes on the DVD
2625but you can get the current version from http://developer.apple.com
2726
2827
29- 1. Pick a directory to work inside.. something like ~/bitcoin works. The
30- structure I use looks like this:
28+ 1. Clone the github tree to get the source code:
3129
32- (~ is your home directory)
30+ git clone git@github.com:bitcoin/bitcoin.git bitcoin
3331
34- ~/bitcoin
35- ~/bitcoin/bitcoin # Upstream source tree
36- ~/bitcoin/src # source code (symlink to ~/bitcoin/bitcoin/src)
37- ~/bitcoin/deps # dependencies.. like libraries and headers needed to compile
32+ 2. Download and install MacPorts from http://www.macports.org/
3833
39- Just execute: mkdir ~/bitcoin
40- This will create the top dir for you..
34+ 3. Install dependencies from MacPorts
4135
42- WARNING: do not use the ~ notation with the configure scripts.. use the full
43- name of the directory, for example /Users/james/bitcoin/deps for a user named
44- 'james'. In my examples I am using 'macosuser' so make sure you change that.
36+ sudo port install boost db48 openssl
4537
46- 2. Check out the bitcoin code from github:
38+ Install the right version of miniupnpc:
39+ pushd bitcoin/contrib/minipupnpc; sudo port install; popd
40+ (this will be unnecessary soon, you will just port install miniupnpc
41+ along with the rest of the dependencies).
4742
48- cd ~/bitcoin
49- git clone https://github.com/bitcoin/bitcoin.git
50- ln -s bitcoin/src src
43+ 4. Now you should be able to build bitcoind:
5144
52- This will make ~/bitcoin/bitcoin for you with all the files from git. This puts
53- the actual sources in ~/bitcoin/bitcoin/src and create a symlink src in
54- ~/bitcoin to this location.
45+ cd bitcoin/src
46+ make -f makefile.osx
5547
56- 3. Get and build the dependencies
57-
58-
59- Boost
60- -----
61-
62- Download from http://www.boost.org/users/download/
63- I'm assuming it ended up in ~/Downloads..
64-
65- mkdir ~/bitcoin/deps
66- cd ~/bitcoin/deps
67- tar xvjf ~/Downloads/boost_1_42_0.tar.bz2
68- cd boost_1_42_0
69- ./bootstrap.sh
70- ./bjam architecture=combined address-model=32_64 macosx-version=10.5 macosx-version-min=10.5 link=static runtime-link=static --toolset=darwin --prefix=/Users/macosuser/bitcoin/deps install
71-
72- If you're using Snow Leopard, you will need to specify 10.6 as your Mac OS X
73- version instead of 10.5.
74-
75- This part takes a while.. use your judgement and fix it if something doesn't
76- build for some reason.
77-
78- Change the prefix to whatever your directory is (my username in this example
79- is macosuser). I'm also running on 10.6 so i have macosx-version=10.6 change
80- to 10.5 if you're using leopard.
81-
82- This is what my output looked like at the end:
83- ...failed updating 2 targets...
84- ...skipped 144 targets...
85- ...updated 8074 targets...
86-
87-
88- OpenSSL
89- -------
90-
91- (System or MacPorts openssl will work fine. Optional.)
92-
93- Download from http://www.openssl.org/source/
94-
95- We would like to build this as a 32 bit/64 bit library so we actually build it
96- 2 times and join it together here.. If you downloaded with safari it already
97- uncompressed it so it will just be a tar not a tar.gz
98-
99- cd ~/bitcoin/deps
100- tar xvf ~/Downloads/openssl-1.0.0.tar
101- mv openssl-1.0.0 openssl-1.0.0-i386
102- tar xvf ~/Downloads/openssl-1.0.0.tar
103- mv openssl-1.0.0 openssl-1.0.0-x86_64
104- # build i386 (32 bit intel) binary
105- cd openssl-1.0.0-i386
106- ./Configure --prefix=/Users/macosuser/bitcoin/deps --openssldir=/Users/macosuser/bitcoin/deps/openssl darwin-i386-cc && make
107- make install # only do this on one of the architectures, to install the headers
108- cd ..
109- # build x86_64 (64 bit intel) binary
110- cd openssl-1.0.0-x86_64
111- ./Configure --prefix=/Users/macosuser/bitcoin/deps --openssldir=/Users/macosuser/bitcoin/deps/openssl darwin64-x86_64-cc && make
112- cd ..
113-
114- # combine the libs
115- cd ~/bitcoin/deps
116- lipo -arch i386 openssl-1.0.0-i386/libcrypto.a -arch x86_64 openssl-1.0.0-x86_64/libcrypto.a -o lib/libcrypto.a -create
117- lipo -arch i386 openssl-1.0.0-i386/libssl.a -arch x86_64 openssl-1.0.0-x86_64/libssl.a -o lib/libssl.a -create
118-
119- Verify your binaries
120-
121- file lib/libcrypto.a
122-
123- output should look like this:
124-
125- lib/libcrypto.a: Mach-O universal binary with 2 architectures
126- lib/libcrypto.a (for architecture i386): current ar archive random library
127- lib/libcrypto.a (for architecture x86_64): current ar archive random library
128-
129-
130- miniupnpc
131- ---------
132-
133- (MacPorts miniupnpc package works fine. You will need to modify makefile.)
134-
135- The process for miniupnpc (optional) is similar to that of OpenSSL.
136-
137- Download from http://miniupnp.tuxfamily.org/files/.
138-
139- cd ~/bitcoin/deps
140- tar xvf ~/Downloads/miniupnpc-1.6.tar
141- mv miniupnpc-1.6 miniupnpc-1.6-x86_64
142- tar xvf ~/Downloads/miniupnpc-1.6.tar
143- mv miniupnpc-1.6 miniupnpc-1.6-i386
144- # build x86_64 (64 bit intel) binary
145- cd miniupnpc-1.6-x86_64
146- export CFLAGS="-arch x86_64"
147- export LDFLAGS="-arch x86_64"
148- export PREFIX="/Users/macuser/bitcoin/deps"
149- make && make install
150- # build i386 (32 bit intel) binary
151- cd miniupnpc-1.6-i386
152- export CFLAGS="-arch i386"
153- export LDFLAGS="-arch i386"
154- export PREFIX="/Users/macuser/bitcoin/deps"
155- make
156-
157- # combine the libs
158- cd ~/bitcoin/deps
159- lipo -arch i386 miniupnpc-1.6-i386/libminiupnpc.a -arch x86_64 miniupnpc-1.6-x86_64/libminiupnpc.a -o lib/libminiupnpc.a -create
160-
161- Verify your binaries
162-
163- file lib/libminiupnpc.a
164-
165- output should look like this:
166-
167- lib/libminiupnpc.a: Mach-O universal binary with 2 architectures
168- lib/libminiupnpc.a (for architecture i386): current ar archive random library
169- lib/libminiupnpc.a (for architecture x86_64): current ar archive random library
170-
171-
172- Berkeley DB
173- -----------
174-
175- (System or MacPorts version work fine.)
176-
177- Download from http://freshmeat.net/projects/berkeleydb/
178-
179- cd ~/bitcoin/deps
180- tar xvf ~/Downloads/db-4.8.30.tar
181- cd db-4.8.30/build_unix
182- ../dist/configure --prefix=/Users/macosuser/bitcoin/deps --enable-cxx && make && make install
183-
184-
185- Now you should be able to build bitcoind:
186-
187- cd ~/bitcoin/src
188- make -f makefile.osx bitcoind
48+ Run:
49+ ./bitcoind --help # for a list of command-line options.
50+ Run
51+ ./bitcoind -daemon # to start the bitcoin daemon.
52+ Run
53+ ./bitcoind help # When the daemon is running, to get a list of RPC commands
0 commit comments