I am trying to run the following to set env, but I can not:
echo 'export ethereum_home=/Users/mattthomas/ethereum' >>~/.bash_profile- Permissions for
.bash_profile:-rw-r--r-- 1 root staff 447 Jun 17 21:50 .bash_profile
How can I write to .bash_profile?
2 Answers
Are you executing the command as root, as your file has the following permissions:
-rw-r--r-- 1 root staff 447 Jun 17 21:50 .bash_profile- You can write only with user
rootor you can usesudowith the command, e.g:sudo echo 'export ethereum_home=/Users/mattthomas/ethereum' >> ~/.bash_profile
Unless you have root privileges, you can not write to .bash_profile. check to see if your .bash_profile has another profile that it sources from. Run
cat ~/.bash_profileand look for something like
. ./blah-blah_profile or something like that. Usually sysadmins do not let the users mess with the main bash_profile but give them a user defined profile to play with.
It is not uncommon to see something like:
. ~/${USER}_profileor
. ~/${USER}.rcetc. pay attention to the space right after the . (dot) character at the beginning of line. That is what "source"s your profile instead of executing it as a script.
If you need further help update your question with the contents of your .bash_profile