on Apple M1 machines, adapted from this guide.

  1. Install Xcode

  2. Install Homebrew:

    1. If you're using the x86 version of Homebrew, uninstall it

      sudo /bin/bash -c "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh>)"
      
    2. Install Homebrew:

      /bin/bash -c "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh>)"
      
    3. Run these two commands in your terminal to add Homebrew to your PATH:

      echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/$YOUR_USERNAME/.zprofile
      
      eval "$(/opt/homebrew/bin/brew shellenv)"
      
  3. Install Rust

    curl --proto '=https' --tlsv1.2 <https://sh.rustup.rs> -sSf | sh
    
  4. Build & install Solana

    1. Clone Solana

      git clone <https://github.com/solana-labs/solana.git>
      cd solanac
      
    2. Install coreutils

      brew install coreutils
      
    3. Install Solana from source

      ./scripts/cargo-install-all.sh .
      
    4. In ~/.zshenv (or whichever shell profile you're using), modify your PATH to include the directory where you installed Solana:

      export PATH="/Users/$YOUR_USERNAME/solana/bin:$PATH"
      
    5. Source the file

      source ~/.zshenv
      
  5. Create a new wallet and run the test validator (then close it with ctrl+c)

solana config set --url localhost

solana config get

solana-keygen new

solana-test-validator
  1. Install node

    1. Install nvm

      curl -o- <https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh> | sh
      

    b. Update ~/.zshenv (and source it)

    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && \\. "$NVM_DIR/nvm.sh"  # This loads nvm
    

    c. Install node

    nvm install v17
    
  2. Install Anchor

    1. Install Mocha

      npm install -g mocha
      

    b. Install Anchor

    cargo install --git <https://github.com/project-serum/anchor> anchor-cli --locked
    

    c. Install yarn

    npm install -g yarn
    
  3. Create a test project & run it!

anchor init myepicproject --javascript

cd myepicproject

anchor test

Anchor Docs: https://project-serum.github.io/anchor/getting-started/introduction.html