Search code examples
ruby-on-railsrubyrbenv

Install ruby using rbenv's downloaded file


I need to install ruby 2.0.0-p645 and I use rbenv. I tried downloading it by running

rbenv install 2.0.0-p645

But the internet in my college keeps dropping every few minutes, so the transfer was always closing with some 11MB remaining.

To counter that, I saw the url from where rbenv was downloading, and used wget to download the source file that rbenv was downloading. (using wget -c for resuming every time the connection closed).

Now I have the file, is there a way to install that ruby version now?

The file's link on cloudfront that I have on my machine.


Solution

  • Yes. Put the downloaded file into ~/.rbenv/cache. You might need to create the directory first. Then run your rbenv install command again. Here is the link to the documentation for this: https://github.com/rbenv/ruby-build#package-download-caching


    To summarize, for future reference:

    1. Download the file using wget
    2. Create a cache folder in ~/.rbenv/ if it doesn't exist already.
    3. Rename the downloaded file to ruby-x.y.z-pabc.tar.gz. Extract it and move it to ~/.rbenv/cache/
    4. Run rbenv install x.y.z-pabc