'Getting Error while installing Rust in macos monterey

I tried installing Rust using the below command

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

but getting an error

error: could not amend shell profile: '/Users/XXXX/.bash_profile': could not write rcfile file: '/Users/XXXX/.bash_profile': Permission denied (os error 13)

my shell profile is zsh



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source