Hirohito Yamada
Hirohito Yamada

Reputation: 387

getting parse error when sourcing bash_profile

I'm currently building rails app which has twitter, fb and instagram login options. I entered the right token and everything but when I do source bash_profile, it gives me this error

`(eval):1: parse error near `then' `

I'm guessing this part of my bash_profile is wrong?

export PATH=/usr/local/bin:$PATH
export PATH=$HOME/.rbenv/bin:$PATH

eval "$(rbenv init -)"

but how could I fix this?


When I hit, ' rbenv init - ' I get the following

export PATH="/Users/sugawara/.rbenv/shims:${PATH}"
export RBENV_SHELL=zsh
source '/usr/local/Cellar/rbenv/1.1.1/libexec/../completions/rbenv.zsh'
command rbenv rehash 2>/dev/null
rbenv() {
  local command
  command="$1"
  if [ "$#" -gt 0 ]; then
    shift
  fi

 case "$command" in
  rehash|shell)
    eval "$(rbenv "sh-$command" "$@")";;
  *)
    command rbenv "$command" "$@";;
  esac
}

Upvotes: 2

Views: 2811

Answers (2)

fabOnReact
fabOnReact

Reputation: 5942

my opinion, after reading the answer from Max is that you need to follow the instructions to set up rbenv and in particular set up your ~/.zshrc file instead of your ~.bash_profile

Add ~/.rbenv/bin to your $PATH for access to the rbenv command-line utility.

$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc

Ubuntu Desktop note: Modify your ~/.bashrc instead of ~/.bash_profile.
Zsh note: Modify your ~/.zshrc file instead of ~/.bash_profile.

as from your rbenv init - output we can see that:

export RBENV_SHELL=zsh
source '/usr/local/Cellar/rbenv/1.1.1/libexec/../completions/rbenv.zsh'

so probably you should set your ~/.zshrc file instead of your ~/.bash_profile

Upvotes: 0

max
max

Reputation: 101811

RBenv integration for Bash looks like this:

export PATH="/Users/sugawara/.rbenv/shims:${PATH}"
export RBENV_SHELL=bash
source '/usr/local/Cellar/rbenv/1.1.1/libexec/../completions/rbenv.bash'
command rbenv rehash 2>/dev/null
rbenv() {
  local command
  command="$1"
  if [ "$#" -gt 0 ]; then
    shift
  fi

  case "$command" in
  rehash|shell)
    eval "$(rbenv "sh-$command" "$@")";;
  *)
    command rbenv "$command" "$@";;
  esac
}

The only explaination I can think of for rbenv init - to output the instruction for the ZSH shell is that you may actually be running zsh instead of bash.

Upvotes: 1

Related Questions