-
Test if XCode command line tools are installed:
xcode-select -p
-
If the command does not print the location of the XCode command-line tools successfully:
xcode-select --install
-
Select XCode locatioh:
sudo xcode-select -s <path/to/Xcode.app>
-
Install brew (follow instructions on brew.sh)
Install git from git-scm, then
git clone https://github.com/MultiChain/multichain.git
cd multichain
set MULTICHAIN_HOME=$(pwd)
mkdir v8build
cd v8build
You can use pre-built headers and binaries of Google's V8 JavaScript engine by downloading and expanding macos-v8.tar.gz in the current directory. If, on the other hand, you prefer to build the V8 component yourself, please follow the instructions in V8_mac.md.
brew install autoconf automake berkeley-db4 libtool [email protected] pkg-config rename python@2 nasm
export LDFLAGS=-L/usr/local/opt/openssl/lib
export CPPFLAGS=-I/usr/local/opt/openssl/include
brew link [email protected] --force
If another Boost version was already installed, then do this:
brew uninstall boost
brew install [email protected]
brew link [email protected] --force
Apple does not support statically linked binaries as documented here, however, it is convenient for end-users to launch a binary without having to first install brew, a third-party system designed for developers.
To create a statically linked MultiChain which only depends on default MacOS dylibs, the following steps are taken:
-
Hide the brew boost dylibs from the build system:
rename -e 's/.dylib/.dylib.hidden/' /usr/local/opt/boost\@1.57/lib/*.dylib
-
Hide the brew berekley-db dylibs from the build system:
rename -e 's/.dylib/.dylib.hidden/' /usr/local/opt/berkeley-db\@4/lib/*.dylib
-
Hide the brew openssl dylibs from the build system:
rename -e 's/.dylib/.dylib.hidden/' /usr/local/opt/openssl/lib/*.dylib
The default brew cookbook for berkeley-db and boost builds static libraries, but the default cookbook for openssl only builds dylibs.
-
Tell brew to build openssl static libraries:
brew edit openssl
In 'def install' => 'args =' change 'shared' to 'no-shared'
brew install openssl --force
cd $MULTICHAIN_HOME
./autogen.sh
./configure --with-gui=no --with-libs=no --with-miniupnpc=no
make
rename -e 's/.dylib.hidden/.dylib/' /usr/local/opt/berkeley-db\@4/lib/*.dylib.hidden
rename -e 's/.dylib.hidden/.dylib/' /usr/local/opt/boost/lib/*.dylib.hidden
rename -e 's/.dylib.hidden/.dylib/' /usr/local/opt/openssl/lib/*.dylib.hidden
brew edit openssl
In 'def install' => 'args =' change 'no-shared' to 'shared'
- This will build
multichaind
,multichain-cli
andmultichain-util
in thesrc
directory.