12
-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

Chris J
  • 30,688
  • 6
  • 69
  • 111
user1288305
  • 121
  • 1
  • 3
  • maybe post your .bash_profile or at least the beginning of it – Mark Fraser Mar 23 '12 at 13:09
  • i typed this: source ~/.bash_profile but i still got the same error: – user1288305 Mar 23 '12 at 13:23
  • Yes, you would. source just tries to load it again. Hard to say what is wrong with the file without seeing what is in it. – Mark Fraser Mar 23 '12 at 13:25
  • If you're trying to get the contents of the file so you can post it here then do `cat ~/.bash_profile` – Mark Fraser Mar 23 '12 at 13:28
  • ok so i did that, and this is what i got: – user1288305 Mar 23 '12 at 13:44
  • [[ -s "$HOME/.rvm/scripts/rvm"]] && . "$HOME/.rvm/scripts/rvm" [[ -s "$HOME/.rvm/scripts/rvm"]] && . "$HOME/.rvm/scripts/rvm" [[ -s "$HOME/.rvm/scripts/rvm"]] && . "$HOME/.rvm/scripts/rvm" [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" – user1288305 Mar 23 '12 at 13:47
  • 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 [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* – user1288305 Mar 23 '12 at 13:47

4 Answers4

17

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.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Homan
  • 25,618
  • 22
  • 70
  • 107
  • Comment out these two lines the /etc/profile file on Mountain Lion > # source /etc/profile.d/sm.sh > # source /etc/profile.d/rvm.sh – Bnjmn Oct 23 '12 at 01:15
  • So that's where that pesky line was coming from! Thank you. – Mugabo Nov 19 '12 at 03:59
8

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.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
user502536
  • 89
  • 1
  • 2
  • 2
    This sounds like an advertisement for Sublime. Any text editor, such as pico, nano, vim, or emacs will work. It doesn't take Sublime to do the task, as much as I like that editor. – the Tin Man Feb 16 '13 at 03:00
  • This worked for me, but OSX wouldn't allow me modify the file with TextEdit, etc. I had to use `sudo vi /etc/profile` (I'm sure `sudo nano...` would work too if you go for that sort of thing) – emersonthis Aug 14 '13 at 15:47
  • I could not edit with TextEdit on my Mac either even after changing the security settings in Get Info. I used TextMate to modify the file. – Pamela Cook - LightBe Corp Dec 22 '13 at 17:45
  • @theTinMan Edited That – Lumin Dec 29 '18 at 10:23
  • @Holyprogrammer: Please don't use comments to notify us of edits. The system puts edit attempts into an approval queue and notifies us. – the Tin Man Apr 08 '19 at 19:24
7

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.

mpapis
  • 52,729
  • 14
  • 121
  • 158
0

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?

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.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Mark Fraser
  • 3,160
  • 2
  • 29
  • 48
  • i tried it out:$ 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 [[-s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" -bash: export: `[[-s': not a valid identifier -bash: export: `/Users/janekambani/.rvm/scripts/rvm': not a valid identifier -bash: export: `]]': not a valid identifier – user1288305 Mar 23 '12 at 14:14
  • i recently installed osx 10.8, had a problem ever since then. – user1288305 Mar 23 '12 at 14:17
  • I usually prefer fresh installs but YMMV. – Mark Fraser Mar 23 '12 at 14:24