For Mac M1 installation with issue try updating rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
rustup component add rustfmt
Install anchor and anchor-cli
cargo install --git https://github.com/project-serum/anchor --tag v0.17.0 anchor-cli --locked
# installing via npm causes issue