First you clone the repository from your terminal and change directory into the new folder that was created.
git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin
Now you can check what version you are working with with this git command
git tag
Read the ReadMe and the build docs for instructions
Linux:more doc/build-unix.md
Mac:more doc/build-osc.md
Install the dependencies
sudo port install boost db48@+no_java openssl miniupnpc autoconf pkgconfig automake
If you haven’t already, install Homebrew. Homebrew is a package manager that installs dependencies to their own directory and then links their files into /usr/local. Homebrew will only install files within its confines and you can download Homebrew wherever you want. If you have already installed Homebrew, update it with the command below.
brew install autoconf automake berkeley-db4 boost miniupnpc openssl pkg-config protobuf
After you have installed the dependencies, you should check that Homebrew installed OpenSSL properly. OpenSSL is a robust toolkit for the Transport Layer Security and Secure Socket Layer protocols that is required.
openssl version
If it hasnt been installed correctly you can force a connection with the command below.
brew link openssl --force
You can now start the build process by generating a set of build scripts. If it is done correctly it should create a set of configuration scripts that will query your system to discover the correct settings and to ensure you have all the necessary libraries to compile the code properly.
./autogen.sh
The most important script that offers many customizations to the build process is the configure script. Check the customizations that are possible with this command.
./configure --help
Usage: To assign a variable specify them as VAR=VALUE
Below are some useful configurations
--version
// displays version information
--disable-FEATURE
// do not include FEATURE (same as –enable-FEATURE=no)
--enable-FEATURE[=ARG]
// include FEATURE [ARG=yes]
Now run the configuration script to automatically discover all the necessary libraries. If all goes well this creates a customized build script for your operating system.
./configure
Start the compilation process. If this returns no errors then bitcoind has been compiled properly.
make
The final step is to install the bitcoind executable into the system path. You need to put in your password for this.
sudo make install
You can confirm that everything is downloaded correctly by checking for the following two paths. Both should return a valid path. The default installation put it in /usr/local/bin.
which bitcoind
which bitcoind-cli