44

I installed Ruby 1.9.3 with RVM, and it works fine. I then made some changes in a ruby C source file, and I want to recompile and re-install it so I can use the changes. I haven't found any kind of rvm recompile command however.

Dogweather
  • 15,512
  • 17
  • 62
  • 81

4 Answers4

60

The problem with using rvm [reinstall|install] is that it will fetch and use precompiled binaries if it can find any. Sometimes, you really want to rebuild from source, probably because you're trying to use a more recent version of GCC (e.g. 4.8 or 4.9).

The correct flag is --disable-binary, not --force:

rvm reinstall --disable-binary 2.1
Carlos Agarie
  • 3,952
  • 1
  • 26
  • 38
  • 3
    This helped when I upgraded from Fedora 23 -> 24 and the mysql2 gem no longer worked because it was compiled against an earlier libmysql. – metaforge Jul 01 '16 at 15:59
31

Ah hah. rvm uninstall [RUBY] followed by rvm install [RUBY] does the trick.

or nicer:

rvm reinstall [RUBY]
Glenn
  • 8,932
  • 2
  • 41
  • 54
Dogweather
  • 15,512
  • 17
  • 62
  • 81
12

or rvm reinstall [RUBY]


three
  • 8,262
  • 3
  • 35
  • 39
8

Use:

rvm install --force

It explicitly asks RVM to use existing sources, in earlier versions this was default - but might be very confusing.

So other commands in ther for installing:

rvm try_install <ruby>

Will only install if not yet installed (your problem)

rvm reinstall <ruby>

is the same as:

rvm remove [--gems] <ruby>
rvm install <ruby>

obviously some time saved with reinstall and use [--gems] to also remove all the gems that were installed with ruby.

mkdir -p projects/smth && cd projects smth
rvm use 1.9.3@gem --install --create --ruby-version

will go to project, install 1.9.3 (if not yet installed), create the gemset, and create .ruby-version file (available only in RVM head before v. 1.11.0) the other flgs:

  • --rvmrc - already available in RVM - will create .rvmrc file
  • --versions-conf - available only in RVM head before v. 1.11.0 - will create .versions.conf - a configuration file for your project, you can put there any important information about your project ... like node.js version
mpapis
  • 52,729
  • 14
  • 121
  • 158