-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
  • Please post the contents of your .bash_profile to your question by editing the original question – Allan May 5 '18 at 16:26
  • 1
    Your .bash_profile probably contains a line similar to export y = x... (i.e. a space or some spaces around the =). Remove the space(s)! – klanomath May 5 '18 at 16:43
  • Is this basically a "how do I fix my script" which is asked and answered in a couple other threads? apple.stackexchange.com/questions/264073/… – bmike May 5 '18 at 16:43
  • export SECRET_KEY_BASE = 0de946...> export SECRET_KEY_BASE=0de946... – klanomath May 6 '18 at 10:19

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


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.

You must log in to answer this question.

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