Reputation: 21934
I can do this:
sudo nano .bash_profile
But when I do this:
sudo echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
I get this error message:
-bash: /Users/mycomputer/.bash_profile: Permission denied
When I do ls -al:
-rw-r--r-- 1 root staff 27 10 Aug 12:22 .bash_profile
Upvotes: 3
Views: 9873
Reputation: 1108
Quick fix: do "sudo bash", to actually assume root privileges, THEN do the echo. It will work. sudo echo still uses your real uid, so it fails.
Upvotes: 4