Ankit Sultana
Ankit Sultana

Reputation: 427

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.

Upvotes: 5

Views: 3380

Answers (2)

Engr. Hasanuzzaman Sumon
Engr. Hasanuzzaman Sumon

Reputation: 2183

For me, the following steps work.

1 Download the file using `wget/curl or any other way`
2. Create a `cache` folder in `~/.rbenv/` if it doesn't exist already.
3. Move the downloaded file to `~/.rbenv/cache/`
4. Run `rbenv install x.y.z` (ex. rbenv install 2.7.1`)

The difference from the above answer was,

- do not need to change file name 
- do not need to extract 
- if file rename to something random (ex. x.y.z-pabc) it show ruby-build: definition not found: x.y.z-pabc

Hope this can help someone.

Upvotes: 7

Paul A Jungwirth
Paul A Jungwirth

Reputation: 24551

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

Upvotes: 7

Related Questions