I noticed the following error in my Mac (Monterey version 12.4) terminal upon opening it today:
(eval):18: parse error near `PATH=/usr/local/opt/...'
I suspected that it was related to my installation and removal of Ruby Version Manager (RVM - https://rvm.io/ ) last week. When I tried using RVM to install Ruby 2.6.1, the installation failed, and upon doing some research, it looked like RVM has issues with install older versions of Ruby on Macs. Therefore, I removed RVM and installed rbenv instead, which worked. Anyway, to uninstall RVM, I ran:
rvm implode
I also removed an RVM line from my bash_profile. This was all done last week.
Upon seeing this new error in my terminal, I ran echo $PATH
, which output this:
/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/francoortega/.rvm/bin
I'm guessing that the .rvm part of this $PATH may be part of the problem.
Next I ran open ~/.bash_profile
and open ~/.bashrc
, which had this info:
bash_profile
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*eval "$(rbenv init -)"
bashrc
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
I tried deleting the rvm info from these files, but that didn't have any effect, so I undid those deletions. Also, it seemed odd that the bash_profile had a line that include rvm and rbenv info
Then, I ran open ~/.zshrc
, which output this:
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
eval "$(rbenv init - zsh)"export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.6.10/bin:$PATH"
I tried deleting the .rvm line, but that had no effect, so I undid that deletion. Then, surprisingly, when I deleted the rbenv file, this removed the terminal error.
However, I don't want to delete rbenv, so I'm not sure what would be the proper way to fix this error.
Additionally, I wasn't able to find the path listed in the error ( /usr/local/opt/
) either.
And since I no longer have RVM, should I delete the rvm lines from the bash_profile bashrc, and .zshrc files?
It looks like the following steps solved my issue:
eval "$(rbenv init - zsh)"export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.6.10/bin:$PATH"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*eval "$(rbenv init -)"
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
My .bashrc and .zshrc files are now empty, and my .bash_profile only contains:
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
My terminal now open without any error message.
Also, I found it strange that the line in my .bash_profile mentioned both rvm and rbenv (see original post above), but reading the rbenv docs, it turns out that I was supposed to remove rvm before installing rbenv, so maybe having rvm on my machine when I install rbenv is what led to this mashup.
Finally, as I mentioned in my original post, I had already removed rvm, but today I removed rbenv with the following two commands (it had been installed via Homebrew):
rm -rf `rbenv root`
brew uninstall rbenv
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.