How to actually build bitcoin on Mac OSX 10.9.1

First of all, if you have Macports, do yourself a favor and get rid of it.

Then make sure you have Homebrew installed and all the packages installed by it up to date.

1. Let’s install all the dependencies for Bitcoin hacking.

brew install autoconf automake berkeley-db4 boost miniupnpc openssl pkg-config protobuf qt libtool

2. Make sure you have the right OpenSSL version installed. Type the following on your terminal:

openssl version

you should see “OpenSSL 1.0.1f 6 Jan 2014.”

if you see an older version, do

brew update
brew upgrade

OpenSSL should be upgraded, you may or may not have to issue a “brew link openssl” or even a “brew link --overwrite openssl” if it’s giving you trouble.

3. Now, let’s configure, and make. I strongly suggest you add the boost library path when configuring, otherwise you may get nasty “Undefined symbols for architecture x86_64” compilation errors. During the time I wrote this, homebrew had installed boost 1.55 in my system, and the boost lib path was /usr/local/Cellar/boost/1.55.0/lib so I invoked the following:

./configure --with-boost-libdir=/usr/local/Cellar/boost/1.55.0/lib

After that I just issued a

make

And I was done.

If you want to hack the bitcoin-qt client like me, head to src/qt/, there should be a bitcoin-qt executable there now.

Enjoy

building cgminer from source on OSX

so you cloned the cgminer repo from github to build on your OSX machine and you get this bullshit error

$ ./autogen.sh
readlink: illegal option -- f
usage: readlink [-n] [file ...]
usage: dirname path
touch: /ltmain.sh: Permission denied
Use of chdir('') or chdir(undef) as chdir() is deprecated at /usr/local/bin/autoreconf line 670.
Configuring...
./autogen.sh: line 10: /configure: No such file or directory

readlink works differently in OSX and the current version of the autogen.sh script seems like it wasn’t tested on OSX (wonder why didn’t they use a simple bs_dir=`pwd`, the answer is probably canonical paths and what not).

To keep moving along, open the autogen.sh script and just change the value of the bs_dir variable to the full real path of where you have cloned the cgminer source code.

then execute your autogen script, make sure to enable compilation flags for your ASIC hardware, in my case I remember seeing ‘icarus’ on a binary build of cgminer I tried before, so I did

./autogen.sh --enable-icarus

you might want to enable all of them if you’re not sure what hardware you have or you will have in the future as you may not like the joys of building software (check out the the README for all the –enable-xxx options available)

If you’re getting errors on your configuration script due to missing dependencies, I strongly recommend you use Homebrew to install these packages (if you are using Macports or Fink, I strongly suggest you completely remove that crap from your computer and go 100% with brew, it works really well if you’re building a lot of code on a regular basis):

brew install autoconf automake autoreconf libtool openssl curses curl

brew, at the point of this writing didn’t have libcurl, so that one you will have to download, ./configure, make and sudo make install yourself from here http://curl.haxx.se/download.html (I used version 7.34 when I did it)

after that the autogen script should work, and then you should be just one ‘make’ away from your goal.