3

I am trying to install NGC CLI on company's Mac following the instructions given here.

https://ngc.nvidia.com/setup/installers/cli

When I try to run the third command there, which is

echo "export PATH=\"\$PATH:$(pwd)\"" >> ~/.bash_profile && source ~/.bash_profile

I get

zsh: permission denied: /Users/rezaafra/.bash_profile

The output of ls -l ~/.bash_profile is

-rw-r--r--  1 root  staff  447 Dec  3 08:45 /Users/rezaafra/.bash_profile

Can anyone help please?

3
  • 2
    You are trying to add to .bash_profile, not .zshrc
    – nohillside
    Commented Dec 16, 2021 at 7:22
  • 2
    Also, you are running zsh so adding something to .bash_profile won't help :-)
    – nohillside
    Commented Dec 16, 2021 at 8:17
  • Does the problem also occur if you are running bash as your interactive shell? Also, why don't you simply edit the file with a text editor? Commented Jan 27, 2022 at 13:09

1 Answer 1

1

The ownership of your .bash_profile seems incorrect. It may be that your company has set it that way on purpose? You could try and fix it with sudo chown ${USER}:staff ~/.bash_profile.

The comment about .bash_profile/.zshrc is correct though in that the bash shell has been replaced by zsh in later versions of MacOS. So you likely should be updating a different file. Try and see if echo "export PATH=\"\$PATH:$(pwd)\"" >> ~/.zshrc && source ~/.zshrc works.

If all else fails, you can run export PATH="$PATH:$(pwd)". But then, you'll have to do that every time you open a terminal.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .