EOS Build Guide on Mac OS

Here is a brief guide to show you how to build the eos on MacOS Sierra 10.12.6. If you use Ubuntu, please check this article : EOS Build Guide on Ubuntu. And this is a traditional installation, not built from Docker.

Upgrate your XCode

This step is very important, please upgrate the xcode verision >=8.3.3

xcode-select --install

Install Dependencies

We use homebrew as our package manager, please install it first. Then execute the following:

brew install automake libtool boost openssl llvm

Install secp256k1-zkp

git clone https://github.com/cryptonomex/secp256k1-zkp.git  
cd secp256k1-zkp
./autogen.sh
./configure
make
sudo make install

Build LLVM and clang for WASM

mkdir  ~/wasm-compiler
cd ~/wasm-compiler
git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/llvm.git
cd llvm/tools
git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/clang.git
cd ..
mkdir build
cd build
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=.. -DLLVM_TARGETS_TO_BUILD= -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DCMAKE_BUILD_TYPE=Release ../
make -j4 install

Add WASM_LLVM_CONFIG and LLVM_DIR to your .zshrc or . bash_profile

echo "export WASM_LLVM_CONFIG=~/wasm-compiler/llvm/bin/llvm-config" >> ~/.zshrc
echo "export LLVM_DIR=/usr/local/Cellar/llvm/4.0.1/lib/cmake/llvm" >> ~/.zshrc
source ~/.zshrc

Using the WASM compiler to perform a full build of the project

git clone https://github.com/eosio/eos --recursive
mkdir -p eos/build && cd eos/build
cmake ..
make -j4

Configure the testnet

cd tests
./chain_test

Produce the blocks

cd eos/programs/eosd
./eosd    # Ctrl+C after run to create config file
vim ./data-dir/config.ini

The sample config.ini

# Load the testnet genesis state, which creates some initial block producers with the default key
genesis-json = /YOUR_PATH/eos/genesis.json
# Enable production on a stale chain, since a single-node test chain is pretty much always stale
enable-stale-production = true
# Enable block production with the testnet producers
producer-name = inita
producer-name = initb
producer-name = initc
producer-name = initd
producer-name = inite
producer-name = initf
producer-name = initg
producer-name = inith
producer-name = initi
producer-name = initj
producer-name = initk
producer-name = initl
producer-name = initm
producer-name = initn
producer-name = inito
producer-name = initp
producer-name = initq
producer-name = initr
producer-name = inits
producer-name = initt
producer-name = initu
# Load the block producer plugin, so we can produce blocks
plugin = eos::producer_plugin

Produce new blocks

./eosd

You are done!!

End

It took me one night to solve a lot of problems, if you have other troubles, just let me know. I will update this guid based on your feedback. Hope it helps you.

Appreciation

区块链技术EOS开发系列之Mac下的编译
EOS Build Guide on Ubuntu
EOS Github

H2
H3
H4
3 columns
2 columns
1 column
14 Comments