Error on terminal start

2019-01-18 12:01发布

问题:

-bash: /etc/profile.d/rvm.sh: No such file or directory
-bash: /Users/janekambani/.bash_profile: line 1: conditional binary operator expected
-bash: /Users/janekambani/.bash_profile: line 1: syntax error near `"$HOME/.rvm/scripts/rvm"'
-bash: /Users/janekambani/.bash_profile: line 1: `[[ -s "$HOME/.rvm/scripts/rvm"]] && . "$HOME/.rvm/scripts/rvm" '

I tried this:

sudo rm -rf /etc/rvmrc /etc/profile.d/rvm.sh /usr/local/rvm /usr/local/bin/rvm $HOME/.rvm $HOME/.rvmrc

but i still kept getting the same error. im using OS X 10.8

回答1:

Take a look at the source of /etc/profile.

On 10.8 of Mac OS, installing RVM while using sudo, adds a line to /etc/profile.d/rvm.sh. Even if you remove RVM using rvm implode, that one liner stays in there and will cause that error to show on start up of any terminal.



回答2:

Use your favorite text editor (nano, vim, etc) to open /etc/profile and comment out these two lines

source /etc/profile.d/sm.sh
source /etc/profile.d/rvm.sh

Then save the file.

Eg.

nano /etc/profile


回答3:

To fix any issues with sourcing RVM use:

rvm get stable --auto-dotfiles #OR:
rvm get head --auto-dotfiles

It will remove existing sourcing lines and add new ones that are meant to work.



回答4:

This is happening due to a botched installation of RVM (at least the part that tried to install the shell loader was botched). Did you recently try to install RVM?

https://rvm.io/

Something kept trying to insert the rvm load code and it has made a mess.

Here is my suggestion:

  1. Make a backup copy of your .bash_profile.
  2. Open it in a text editor and remove everything but:
export PATH=/Applications/SenchaSDKTools-2.0.0-Developer-Preview:$PATH 
export PATH=/Applications/SenchaSDKTools-2.0.0-Developer-Preview/command:$PATH
export PATH=/Applications/SenchaSDKTools-2.0.0-Developer-Preview/jsbuilder:$PATH

Add this line below that:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

Save it and open another terminal and see if the error goes away.