1

I'm currently trying to learn Rails, and in the process, I compiled Ruby on my own, as I did with Python, expecting the same process.

However, after digging a bit, I eventually gave up and just started using rvm. I've installed everything, but after a few moments realized my system (Ubuntu 11.10) thought I was using the version of Ruby I compiled (which was missing openssl) rather than rvm's version of Ruby, which was complete.

I "uninstalled" it according to this post, and after reinstalling rvm's Ruby with openssl, iconv, and rails, I'm now getting the following error message:

secretasianman@ubuntu:~/Projects/first_app$ rails server
bash: /usr/local/bin/rails: /usr/local/bin/ruby: bad interpreter: No such file or directory

Any idea on how to fix this? I've edited the last two lines of ~/.bashrc to read like the following, but to no avail.

PATH=$PATH:$HOME/.rvm/bin:$HOME/.rvm/rubies/ruby-1.9.3-p125/bin # Add RVM to PATH for scripting
export PATH
Community
  • 1
  • 1
Edwin
  • 2,074
  • 1
  • 21
  • 40
  • There's nothing special about an "RVM version" of Ruby—and it is in fact compiled. Also, how did you install Rails? – Andrew Marshall Apr 11 '12 at 21:25
  • @Andrew I know they're both compiled; I was simply referring to whom compiled Ruby. Rails I installed via `gem install rails`. – Edwin Apr 11 '12 at 21:31
  • Did you install it a different way at one point? E.g. via the Ubuntu package manager? – Andrew Marshall Apr 11 '12 at 21:34
  • @Andrew After installing `openssl` myself and via `rvm`, I did try `sudo apt-get install libdev-openssl`. – Edwin Apr 11 '12 at 21:45

2 Answers2

1

try adding to ~/.bashrc

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

then in a new shell try

ruby -v 
Pietro
  • 156
  • 1
  • 4
  • Works for `ruby`, but doesn't work for `irb` or `rails server`. – Edwin Apr 11 '12 at 21:33
  • If you installed rails with uncorrect .bashrc you used system gem and not the rvm gem. "which rails" should show something like "~/.rvm/gems/ruby-1.9.3-p125/bin/rails". If it does not, control which gem command are you using. "which gem" should be something like "~/.rvm/rubies/ruby-1.9.3-p125/bin/gem". If so, reinstall rails. – Pietro Apr 12 '12 at 09:00
  • Not sure why, but it only worked after a full refresh of the system (instead of just `source ~/.bashrc` and restarting the terminal). Thanks! – Edwin Apr 13 '12 at 02:13
-2

You may want to give a look to rbenv which works in a simpler way (just changing PATH)

To install it (I use .bashrc instead of .bash_profile). Make sure you remove all traces of rvm:

$ cd
$ git clone git://github.com/sstephenson/rbenv.git .rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

And restart your shell:

$ exec $SHELL

To get the "rbenv install" command to install a particular version, install also ruby-build. rbenv separates the two commands so that rbenv also works with custom built rubies.

$ git clone git://github.com/sstephenson/ruby-build.git
$ cd ruby-build
$ ./install.sh
duncan
  • 6,113
  • 3
  • 29
  • 24
  • Not sure what this is supposed to do, but after refreshing with `source`, `exec`, and a new terminal, `rbenv install` doesn't do anything. – Edwin Apr 11 '12 at 22:17
  • More importantly, it doesn't answer my question; it merely uninstalls ruby. – Edwin Apr 11 '12 at 22:18