From 5750f5e69b9b7a8ed7ba03d5a5a906af9c16824e Mon Sep 17 00:00:00 2001 From: Peter Zhang Date: Fri, 5 Jul 2024 20:37:30 +0800 Subject: [PATCH] add mac support --- networks/testnet/install.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/networks/testnet/install.sh b/networks/testnet/install.sh index 2211e8b5..8c101084 100755 --- a/networks/testnet/install.sh +++ b/networks/testnet/install.sh @@ -1,10 +1,18 @@ #!/bin/bash -# Install dependent libraries -go version 2>/dev/null || sudo snap install go --classic -jq --version 2>/dev/null || sudo snap install jq -make --version 2>/dev/null || sudo apt install make -y -gcc --version 2>/dev/null || (sudo apt-get update; sudo apt install gcc -y) +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + # Install dependent libraries + go version 2>/dev/null || sudo snap install go --classic + jq --version 2>/dev/null || sudo snap install jq + make --version 2>/dev/null || sudo apt install make -y + gcc --version 2>/dev/null || (sudo apt-get update; sudo apt install gcc -y) +elif [[ "$OSTYPE" == "darwin"* ]]; then + # Install dependent libraries + go version 2>/dev/null || brew install go + jq --version 2>/dev/null || brew install jq + make --version 2>/dev/null || brew install make + gcc --version 2>/dev/null || brew install gcc +fi # Build binary export PATH=$PATH:$(go env GOPATH)/bin @@ -15,7 +23,6 @@ if [[ $? -ne 0 ]]; then cd $SCRIPT_DIR/../.. rm -rf $(go env GOPATH)/bin/0gchaind make install - # Add gopath to path echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.profile fi