5

I have successfully installed rbenv and ruby build on mountain lion. Running rbenv install 1.9.3-p392 ends with:

checksum mismatch: ruby-1.9.3-p392.tar.gz (file is corrupt) expected f689a7b61379f83cbbed3c7077d83859, got 1cfc2ff433dbe80f8ff1a9dba2fd5636

The file that it is downloading seems fine, and if I download the file manually using curl, I get the same incorrect checksum.

Has anybody encountered this before? How did they resolve it?

Cam
  • 1,655
  • 17
  • 19

2 Answers2

9

tl:dr; Download the ruby using your browser from http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz and place it in ~/.rbenv/caches/ruby-1.9.3-p392.tar.gz, then run rbenv install 1.9.3-p392

The problem lies with curl, and the ftp.ruby-lang.org server. Because curl does not pass through Accept-Encoding: gzip, the server delivers the non-gzipped version of the ruby (~60mb) instead of the compressed version (~12mb). This causes the checksum to fail, and the build to stop.

Downloading the file with curl --header "Accept-Encoding: gzip", gives the correct checksum. However, the latest version of rbenv passes the -q flag to curl, which ignores .curlrc files, making this hard to configure without editing the source.

The easy solution is to download the ruby.tar.gz manually and place it in the cache folder, skipping the issue entirely.

Cam
  • 1,655
  • 17
  • 19
  • 5
    Thanks. It looks like the cache directory is now `~/.rbenv/cache` **no s on the end**. – Craz Mar 01 '13 at 23:42
  • 1
    I discovered that my `~/.curlrc` which had `--compressed` as one of the options was the source of the problems. – Michael Hale Apr 19 '13 at 16:22
0

Not sure if related, but after I had that problem, and read the @Cam's answer, I decided to install curl from brew, and when I tried it again to install ruby it worked.

So brew install curl and check if it works for you.

sparrovv
  • 6,894
  • 2
  • 29
  • 34