Installing Solana ToolChain Natively on MacBook M1, M1 Pro and M1 Max

Tauqueer Khan's profile picture

Tauqueer Khan

Full Stack Developer
Twitter

· 3 min read


Lets get you setup with the Solana Toolchain natively on the M1, M1 Pro and M1 Max.

One assumption I'll make before getting started is that when you type solana in your terminal you see the below

> solana zsh: command not found

If you don't have Rust installed use this command to install it. Ensure that you are installing the aarch64-apple-darwin default version

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Reopen the terminal and type rustup or rust --version and it shouldn't say command not found

You also want to install Homebrew if you don't have that.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Next we are going to run this command. We ultimately won't use rosetta but some packages of the toolchain seem to need it to install properly.

software update —-install-rosetta

Clone the Solana github repo in a directory of your choosing

https://github.com/solana-labs/solana.git

Once that’s done, cd into the Solana folder and now we will checkout the v1.8.7 branch. We want the version that is highest and suitable for use on Mainnet Beta here go with that.

cd solana git checkout v1.8.7

Next we want to install coreutils. This will help us get over the greadlink: command not found error

brew install coreutils

We also want to install OpenSSL

brew install openssl@1.1

Lastly from the solana folder, we want to run the script below. This will take some time as we are compiling all the toolchain binaries.

./scripts/cargo-install-all.sh .

Once completed, lets export the binaries from the bin folder to the PATH

export PATH=$PWD/bin:$PATH

All the Solana CLI commands should be accessible and running natively at this point. But we aren't done!

Since we chose the chew glass method, the config file was never setup. Type

solana config get

This will create the .config folder with the yml file in it but it will link us to mainnet. So lets change that

solana config set --url localhost

Now if you type

solana balance
, you will get another error where our default wallet isn't found. So lets follow the suggestion and copy paste what you see similar to this
solana-keygen new -o /Users/YOUR_COMPUTER_NAME/.config/solana/id.json

If your local test validator isn't running, type

solana-test-validator

Now if you type

solana balance
, you should see some imaginary SOL

Now the last thing I wanted to talk about was Anchor. When developing locally, the local test validator as is (won't work since BPF-JIT only support X86_64)[https://github.com/solana-labs/solana/issues/18033#issuecomment-962718203]. We have to add the --no-bpf-jit flag

solana-test-validator --no-bpf-jit

And with that we have setup our systems to develop Solana natively using the M1, M1 Pro or Max. If you have any question, you can reach me @_tkoriginal.


Web3
Blockchain
Solana
Apple Silicon
Share

Stack Five a digital product dev shop that strives to push the boundaries of the web and build meaningful things. If you're looking to create a cutting-edge web application or need software engineering resources for your project, please contact us.

Stack Five logo

2022 Stack Five Inc. | Toronto, Canada