Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rbenv installing ruby checksum mismatch osx

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?

like image 380
Cam Avatar asked Feb 27 '13 21:02

Cam


1 Answers

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.

like image 194
Cam Avatar answered Nov 15 '22 09:11

Cam