Mac – Unknown error message in Terminal .bash_profile

errormacterminal

-bash: export: =': not a valid identifier
-bash: export:
0de946b3adfc5de6336ff06ca740ffbeba68f055323038a179def14f63ee3b1b7aa0b50bdd8a7b7578d8c19f1a5e62fff0047843b252e551426e2c0a5f49ee88': not a valid identifier

I was following a guide to install postgres , and i added a PATH to .bash_profile .Then i deleted it and now i am facing this error every time i open the terminal.

This is my bash profile

[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi


[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export SECRET_KEY_BASE = 0de946b3adfc5de6336ff06ca740ffbeba68f055323038a179def14f63ee3b1b7aa0b50bdd8a7b7578d8c19f1a5e62fff0047843b252e551426e2c0a5f49ee88

Best Answer

If you want to export a variable, the variable name, the equal sign and the value of the variable mustn't be separated by spaces! Especially the equal sign is no valid variable name and surrounded by spaces it's interpreted as such resulting in the "=': not a valid identifier" error message.

So change the line

export SECRET_KEY_BASE = 0de946b3adfc5de6336ff06ca740ffbeba68f055323038a179def14f63ee3b1b7aa0b50bdd8a7b7578d8c19f1a5e62fff0047843b252e551426e2c0a5f49ee88

to

export SECRET_KEY_BASE=0de946b3adfc5de6336ff06ca740ffbeba68f055323038a179def14f63ee3b1b7aa0b50bdd8a7b7578d8c19f1a5e62fff0047843b252e551426e2c0a5f49ee88

and either re-source .bash_profile or close your current Terminal window and open a new one to get rid of the error.