Search code examples
rvmgnupgbash

Bash Unexpected End of File Error After Installing RVM


I executed the following commands under BASH to install RVM:

brew install gnupg gnupg2

gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3

\curl -sSL https://get.rvm.io | bash

Now, when I open my terminal, I receive the following error message:

-bash: eval: line 19: syntax error: unexpected end of file

Here is my .bash_profile:

export PATH=/usr/local/bin:$PATH
eval "$(rbenv init -)i"
alias sbl='/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl'

#changes prompt to be colorized and rearranges prompt to be "username@hotname:cwd $"
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "

#enable command line colors, and define colors for the ‘ls’ command
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad

#flags -G colorizes output, -h makes sizes human readable, and -F throws a / after a directory
alias ls='ls -GFh'


#Need to add below after 'brew install git bash-completion'
if [ -f `brew --prefix`/etc/bash_completion ]; then
    . `brew --prefix`/etc/bash_completion
fi
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"

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

Can someone point out what is causing the error? I am not familiar with BASH programming. RVM is working.


Solution

  • It looks to me like you have a stray "i" at the end of the second line:

    eval "$(rbenv init -)i"
    

    Because of that, eval is trying to run a command sequence that looks something like this:

    export PATH="/Users/pc3sq/.rbenv/shims:${PATH}"
    # [...]
    rbenv() {
        # [...]
    }i
    

    ...and since "}i" is not a valid match for the "{" that starts the function definition, eval runs into the end of the "file" (actually just a string) while it's still looking for a "}" to close the function definition.