How to build a portable bitcoind binary for macOS? Bitcoin Core ships a portable bitcoind with the Linux and Windows releases, but doesn't ship one with macOS. And I couldn't find instructions on how to build one.

Can someone provide step-by-step instructions on how to build a portable bitcoind binary for macOS? 

The host platform can be Ubuntu or macOS. I have access to both.

(Just to clarify, the goal is to have a self-contained bitcoind binary that runs on different macOS machines without having to install additional dependencies)
macOS portable binaries are uploaded to bitcoincore.org. On the download page, under Mac OS X is a link to tar.gz. That tarball contains the macOS portable binaries.



Bitcoin Core's release process using gitian does produce these portable binaries. So you can replicate the same process to build your own portable binaries. You can read about how to do that here.

There is a script, contrib/gitian-build.py that should do everything for you. It should work on Ubuntu. It will install all of the necessary dependencies and setup the gitian environment before doing the build when you run it with the --setup option.

Your build command with this script would look something like

bitcoin/contrib/gitian-build.py -Dnb -o x &lt;name&gt; 0.20.0


Use the -h option to get usage information

-D tells the script to not try to sign the resulting .assert file that contains all of the build hashes.

-n tells the script to not try to commit the .assert file that is created.

-b means to do a build

-o x tells the script to specifically do a macOS build (-o means operating system, x for OSX)

&lt;name&gt; that's where you would put your username. This is just for identifying signers who participate in the gitian build process. You can just set this to be whatever you want.

0.20.0 is the version to build, in this case, 0.20.0. You can put whatever other version you want.

The script will create a directory named bitcoin-binaries. Inside of that will be a directory with the version name. And inside that directory will be 2 files - a .tar.gz file and a .dmg file. The .tar.gz file contains the portable binaries that you can use.



Additionally some gitian builders (like myself) upload all of their gitian build results so you could just download those files.

Personally, I upload my results to github. The macOS portable binaries are named bitcoin-&lt;version&gt;-osx64.tar.gz.

Jonas Schnelli also uploads the results of his builds. You can find them at on his website.

In both cases, the files that you download should have hashes that match those of other gitian builds. The gitian builders commit their hashes to this github repository so you can go there to check that the file you download has the same hash that the gitian builders computed.