This content originally appeared on DEV Community and was authored by 0xMuse
Although both the Solana Tool Suite and Anchor have already got good native support for the M1 architecture, there are currently no official binary builds for the new Macs.
In this guide, we will go through all the steps needed to compile and install the tools on your machine natively, without having to set up a cumbersome Rosetta environment.
Install Rust
First, you will need to install the Rust toolchain.
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
rustup component add rustfmt
This should be all what we need.
Install Solana Tool Suite
Before compiling the Solana Tool Suite, you will need coreutils
installed on your computer in case you don’t have it:
brew install coreutils
Now let’s clone the Solana repository. I’m using shallow cloning to speed up things since the entire commit history is not needed.
# grab only the repo state at the v1.9.2 tag
git clone --depth 1 --branch v1.9.2 https://github.com/solana-labs/solana.git
Then, go into the directory and run the cargo-install-all.sh
script.
cd solana
./scripts/cargo-install-all.sh .
echo "export PATH=$PWD/bin:\$PATH" >> ~/.zshrc
This will take a while, but after it is finished, you can verify if the installation is successful with:
solana --version
There used to be an issue with solana-test-validator
on M1 Macs, but the problem has been solved. You can try to spin it up to make sure it works.
Install Anchor
Anchor is the recommended framework for Solana programs.
Note that Anchor uses Yarn v1 to manage Javascript dependencies in your project, so make sure you already have it installed on your computer.
Since there’s no official binary available for the M1 architecture, we’ll also need to build from source:
cargo install --git https://github.com/project-serum/anchor --tag v0.19.0 anchor-cli --locked
Then, you can verify if the installation is successful with:
anchor --version
And that’s it. Have fun building with Solana on your M1 Mac natively!
Also building in Web3? Let's connect via Twitter đź‘‹ @0xMuse
This content originally appeared on DEV Community and was authored by 0xMuse
0xMuse | Sciencx (2022-01-03T20:33:05+00:00) Install Solana on M1 Macs, without Rosetta đź’ˇ. Retrieved from https://www.scien.cx/2022/01/03/install-solana-on-m1-macs-without-rosetta-%f0%9f%92%a1/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.