'Why isn't my path updating with the components I added?

I have been trying to install the Solana tool suite on my M1 pro MacBook Pro and have kept running into the same issue no matter how I do it. Basically when I install the Solana tool suite using sudo and add it to my path it works in the current terminal instance. When I type echo $PATH it shows up but when I close the terminal and try doing the same in the new instance I first of all, get zsh : command not found : solana and when running echo $PATH, the Solana CLI isn't there anymore for some reason. I'm pretty new to Mac so some help would be useful...



Solution 1:[1]

Include the command used to add the path in your ~/.zshrc file

Solution 2:[2]

To add your path globally, type this command open ~/.zshrc and paste the path and save the file. This would show the path even after restarting the terminal.

# in ~/.zshrc
export PATH=<my_solana_path>:$PATH

Then either open a new terminal or in a new terminal source ~/.zshrc

Solution 3:[3]

This seemed to solve the problem for me"

Don't give :$PATH at the end during adding the variable, rather add it first

# in ~/zshrc
export PATH=$PATH:<my_solana_path>
# omit ":$PATH" after it

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 Arun
Solution 2 Kevin Meyer
Solution 3 Snehendu Roy