<p>The other answer here probably works, but has way too many steps for my taste.</p>

<p><code>npm install bitcore-node -g</code></p>

<p>Even though you're installing bitcore-node, it includes the bitcoind dependency which you can use by itself or with bitcore to add services on top of bitcoind</p>

CC BY-SA 3.0
2017-06-02T17:06:08.263Z
2017-06-02T17:06:08.263Z
arshbot
<p><strong>Update:</strong> These instructions or similar are included in the bitcoin source as of <em>19 February 2013</em>. See <a href="https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md" rel="nofollow noreferrer"><code>doc/build-osx.md</code></a> for details. As such, the below instructions may fall out of date. Alternatively, make it easy on yourself an use <a href="https://github.com/WyseNynja/homebrew-bitcoin" rel="nofollow noreferrer">WyseNynja's homebrew tap</a> with <code>brew tap wysenynja/bitcoin &amp;&amp; brew install bitcoind</code>.</p>

<h1>Building bitcoind on OSX 10.8 with homebrew</h1>

<p>I got bitcoind working using these instructions. For reference, I'm on OSX 10.8.2 with homebrew 0.9.3. I've made an assumption throughout that homebrew is installed in /usr/local. I've also assumed that you've installed the Xcode command line utilities and any other packages that are essential to building code. If you build any code regularly, e.g. you have RVM installed to build ruby occasionally, you're probably OK!</p>

<p>Install some necessary libraries from homebrew.</p>

<pre><code>brew install boost miniupnpc openssl
</code></pre>

<p>Revert berkeley-db formula to an older version</p>

<pre><code>cd /usr/local
git checkout e6a374d Library/Formula/berkeley-db.rb
</code></pre>

<p>You may have to unlink it if you've already installed the latest version.</p>

<pre><code>brew unlink berkeley-db
</code></pre>

<p>Install berkeley-db 4.8 now that you've got the right formula in place.</p>

<pre><code>brew install berkeley-db
</code></pre>

<p>Checkout from Github.</p>

<pre><code>git clone https://github.com/bitcoin/bitcoin.git
</code></pre>

<p>Edit the makefile.osx to change it a bit. Here's a diff that shows what you need to change, or you can just use this as a patch by doing <code>echo '$patch-text' | patch</code>, where $patch-text is the patch text below.</p>

<pre><code>diff --git a/src/makefile.osx b/src/makefile.osx
index 9629545..ffac9a3 100644
--- a/src/makefile.osx
+++ b/src/makefile.osx
@@ -7,17 +7,19 @@
 # Originally by Laszlo Hanyecz (solar@heliacal.net)

 CXX=llvm-g++
-DEPSDIR=/opt/local
+DEPSDIR?=/opt/local

 INCLUDEPATHS= \
  -I"$(CURDIR)" \
  -I"$(CURDIR)"/obj \
  -I"$(DEPSDIR)/include" \
- -I"$(DEPSDIR)/include/db48"
+ -I"$(DEPSDIR)/include/db48" \
+ -I"/usr/local/Cellar/openssl/1.0.1c/include"

 LIBPATHS= \
  -L"$(DEPSDIR)/lib" \
- -L"$(DEPSDIR)/lib/db48"
+ -L"$(DEPSDIR)/lib/db48" \
+ -L"/usr/local/Cellar/openssl/1.0.1c/lib"

 USE_UPNP:=1
 USE_IPV6:=1
</code></pre>

<p>Start the build.</p>

<pre><code>cd bitcoin/src
make -f makefile.osx DEPSDIR=/usr/local
</code></pre>

<p>It's now available at ./bitcoind. We have to first create the rpc configuration file, though. Run ./bitcoind to get the filename where it should be put, or just try the below text.</p>

<pre><code>echo "rpcuser=bitcoinrpc
rpcpassword=HdAseQSRkirfoNuUSzqzixyL9sM1T6ABfzV1nyNmbuwg" &gt; "/Users/${USER}/Library/Application Support/Bitcoin/bitcoin.conf"
chmod 600 "/Users/${USER}/Library/Application Support/Bitcoin/bitcoin.conf"
</code></pre>

<p>When next you run it, it will start downloading the blockchain, but it won't output anything while it's doing this. This process may take several hours.</p>

<p>Mine appears to be working fine, but it's still downloading the blockchain. I'll be able to tell after some testing if it's working normally or not, but I suspect that it is!</p>

<p>Inspirations:</p>

<ul>
<li><a href="https://github.com/WyseNynja/homebrew-bitcoin/blob/master/bitcoind.rb" rel="nofollow noreferrer">https://github.com/WyseNynja/homebrew-bitcoin/blob/master/bitcoind.rb</a></li>
<li><a href="https://bitcoin.stackexchange.com/questions/793/what-are-the-steps-in-building-bitcoind-on-mac-os-x-10-6">What are the steps in building bitcoind on Mac OS X 10.6?</a></li>
<li><a href="https://bitcoin.stackexchange.com/questions/3672/trouble-compiling-bitcoind-on-osx-with-homebrew">Trouble compiling bitcoind on OSX with homebrew</a></li>
</ul>

CC BY-SA 3.0
2014-01-23T10:05:26.117Z
`brew install berkeley-db` is throwing `Error: No available formula for berkeley-db`
Petr Peller
CC BY-SA 3.0
2014-01-23T10:06:27.343Z
It works with formula in HEAD. Perhaps the commit hash is wrong?
Petr Peller
CC BY-SA 3.0
2014-01-24T14:03:06.567Z
You'll want to use the `berkeley-db4` formula now from homebrew-versions. That commit hash was for when the berkeley-db formula didn't have separate branches.
Colin Dean
CC BY-SA 3.0
2012-11-03T03:34:33.197Z
2013-09-01T03:15:46.773Z
2017-04-13T12:47:33.583Z
Colin Dean
<p>I've read the README on the bitcoin github page which instructs you to install the following libraries using MacPorts - <code>boost</code> <code>db48</code> <code>dbus</code> <code>openssl</code>.</p>
<p>I have these installed using <code>homebrew</code> which I use instead of MacPorts. They are also the correct versions as <code>homebrew</code> installs, later, incompatible versions.</p>
<p>With these installed I edited the <code>make</code> to point to the libraries <code>homebrew</code> installed namely <code>DEPSDIR=/usr/local</code> and adding  <code>-I&quot;$(DEPSDIR)/Cellar/berkeley-db4/4.8.30/include&quot;</code> to <code>INCLUDEPATHS</code></p>
<p>However I'm getting this compiler error which is cryptic to me:</p>
<p><a href="https://gist.github.com/ashleyconnor/944f611b969444f06430145972b880cf" rel="nofollow noreferrer">https://gist.github.com/ashleyconnor/944f611b969444f06430145972b880cf</a></p>
<p>Has anybody managed to get this working?</p>

<client><mac><compiling>
Trouble compiling bitcoind on OSX with homebrew
Ashley
# Trouble compiling bitcoind on OSX with homebrew

(Asked by: username_0 on 2012-05-14)

I've read the README on the bitcoin github page which instructs you to install the following libraries using MacPorts - `boost` `db48` `dbus` `openssl`.

I have these installed using `homebrew` which I use instead of MacPorts. They are also the correct versions as `homebrew` installs, later, incompatible versions.

With these installed I edited the `make` to point to the libraries `homebrew` installed namely `DEPSDIR=/usr/local` and adding `-I"$(DEPSDIR)/Cellar/berkeley-db4/4.8.30/include"` to `INCLUDEPATHS`

However I'm getting this compiler error which is cryptic to me:

<https://gist.github.com/ashleyconnor/944f611b969444f06430145972b880cf>

Has anybody managed to get this working?

**Tags:** client, mac, compiling


---

## 2 answers

### Answer by username_2 on 2012-11-03. Score: 11 | Accepted answer

**Update:** These instructions or similar are included in the bitcoin source as of *19 February 2013*. See [`doc/build-osx.md`](https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md) for details. As such, the below instructions may fall out of date. Alternatively, make it easy on yourself an use [WyseNynja's homebrew tap](https://github.com/WyseNynja/homebrew-bitcoin) with `brew tap wysenynja/bitcoin && brew install bitcoind`.

# Building bitcoind on OSX 10.8 with homebrew

I got bitcoind working using these instructions. For reference, I'm on OSX 10.8.2 with homebrew 0.9.3. I've made an assumption throughout that homebrew is installed in /usr/local. I've also assumed that you've installed the Xcode command line utilities and any other packages that are essential to building code. If you build any code regularly, e.g. you have RVM installed to build ruby occasionally, you're probably OK!

Install some necessary libraries from homebrew.

```
brew install boost miniupnpc openssl

```

Revert berkeley-db formula to an older version

```
cd /usr/local
git checkout e6a374d Library/Formula/berkeley-db.rb

```

You may have to unlink it if you've already installed the latest version.

```
brew unlink berkeley-db

```

Install berkeley-db 4.8 now that you've got the right formula in place.

```
brew install berkeley-db

```

Checkout from Github.

```
git clone https://github.com/bitcoin/bitcoin.git

```

Edit the makefile.osx to change it a bit. Here's a diff that shows what you need to change, or you can just use this as a patch by doing `echo '$patch-text' | patch`, where $patch-text is the patch text below.

```
diff --git a/src/makefile.osx b/src/makefile.osx
index 9629545..ffac9a3 100644
--- a/src/makefile.osx
+++ b/src/makefile.osx
@@ -7,17 +7,19 @@
 # Originally by Laszlo Hanyecz (solar@heliacal.net)

 CXX=llvm-g++
-DEPSDIR=/opt/local
+DEPSDIR?=/opt/local

 INCLUDEPATHS= \
  -I"$(CURDIR)" \
  -I"$(CURDIR)"/obj \
  -I"$(DEPSDIR)/include" \
- -I"$(DEPSDIR)/include/db48"
+ -I"$(DEPSDIR)/include/db48" \
+ -I"/usr/local/Cellar/openssl/1.0.1c/include"

 LIBPATHS= \
  -L"$(DEPSDIR)/lib" \
- -L"$(DEPSDIR)/lib/db48"
+ -L"$(DEPSDIR)/lib/db48" \
+ -L"/usr/local/Cellar/openssl/1.0.1c/lib"

 USE_UPNP:=1
 USE_IPV6:=1

```

Start the build.

```
cd bitcoin/src
make -f makefile.osx DEPSDIR=/usr/local

```

It's now available at ./bitcoind. We have to first create the rpc configuration file, though. Run ./bitcoind to get the filename where it should be put, or just try the below text.

```
echo "rpcuser=bitcoinrpc
rpcpassword=HdAseQSRkirfoNuUSzqzixyL9sM1T6ABfzV1nyNmbuwg" > "/Users/${USER}/Library/Application Support/Bitcoin/bitcoin.conf"
chmod 600 "/Users/${USER}/Library/Application Support/Bitcoin/bitcoin.conf"

```

When next you run it, it will start downloading the blockchain, but it won't output anything while it's doing this. This process may take several hours.

Mine appears to be working fine, but it's still downloading the blockchain. I'll be able to tell after some testing if it's working normally or not, but I suspect that it is!

Inspirations:

* <https://github.com/WyseNynja/homebrew-bitcoin/blob/master/bitcoind.rb>
* [What are the steps in building bitcoind on Mac OS X 10.6?](https://bitcoin.stackexchange.com/questions/793/what-are-the-steps-in-building-bitcoind-on-mac-os-x-10-6)
* [Trouble compiling bitcoind on OSX with homebrew](https://bitcoin.stackexchange.com/questions/3672/trouble-compiling-bitcoind-on-osx-with-homebrew)

> **Comments:**
> **username_3**: `brew install berkeley-db` is throwing `Error: No available formula for berkeley-db`  
> **username_3**: It works with formula in HEAD. Perhaps the commit hash is wrong?  
> **username_2**: You'll want to use the `berkeley-db4` formula now from homebrew-versions. That commit hash was for when the berkeley-db formula didn't have separate branches.  

---

### Answer by username_1 on 2017-06-02. Score: 0

The other answer here probably works, but has way too many steps for my taste.

`npm install bitcore-node -g`

Even though you're installing bitcore-node, it includes the bitcoind dependency which you can use by itself or with bitcore to add services on top of bitcoind


---

