3

I'm trying to (re-)install ruby 1.8.7 using rvm 1.29.1 on a brand new MBP running OS X Sierra. I HAVE to get this done for work, I'm not in a position to switch to a more current version or anything unfortunately.

I had a functional install of this but after getting some weird errors in a project decided to try a completely clean reinstall of both rvm (and eventually homebrew!) (long story- had a broken file structure after removing an unwanted space from the name of my home directory!). I was careful to remove all traces of the old install from .bashrc, .profile etc following other posts on here. 2.4.0 installs and runs fine. However, on trying to install 1.8.7:

9bxbniv1:~ Rob$ rvm install ruby-1.8.7

Warning! Requested ruby installation which requires another ruby available - installing ruby-1.8.7-p374 first.

ruby-1.8.7-p374 - #removing src/ruby-1.8.7-p374..
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl@1.1/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/Rob/.rvm/rubies/ruby-1.8.7-p374, this may take a while depending on your cpu(s)...
ruby-1.8.7-p374 - #downloading ruby-1.8.7-p374, this may take a while depending on your connection...
ruby-1.8.7-p374 - #extracting ruby-1.8.7-p374 to /Users/Rob/.rvm/src/ruby-1.8.7-p374....
ruby-1.8.7-p374 - #applying patch /Users/Rob/.rvm/patches/ruby/1.8.7/stdout-rouge-fix.patch.
ruby-1.8.7-p374 - #applying patch /Users/Rob/.rvm/patches/ruby/1.8.7/no_sslv2.diff.
ruby-1.8.7-p374 - #applying patch /Users/Rob/.rvm/patches/ruby/GH-488.patch.
ruby-1.8.7-p374 - #applying patch /Users/Rob/.rvm/patches/ruby/ssl_no_ec2m.patch.
ruby-1.8.7-p374 - #configuring...............................
ruby-1.8.7-p374 - #post-configuration.
ruby-1.8.7-p374 - #compiling................................
Error running '__rvm_make -j 1',
showing last 15 lines of /Users/Rob/.rvm/log/1488471654_ruby-1.8.7-p374/make.log
                            ^
openssl_missing.c:107:28: error: dereferencing pointer to incomplete type
     EVP_MD_CTX_cleanup(&ctx->o_ctx);
                            ^
openssl_missing.c:108:28: error: dereferencing pointer to incomplete type
     EVP_MD_CTX_cleanup(&ctx->md_ctx);
                            ^
In file included from /usr/include/string.h:192:0,
                 from openssl_missing.c:19:
openssl_missing.c:109:27: error: invalid application of 'sizeof' to incomplete type 'HMAC_CTX'
     memset(ctx, 0, sizeof(HMAC_CTX));
                           ^
make[1]: *** [openssl_missing.o] Error 1
make: *** [all] Error 1
+++ return 2
There has been an error while running make. Halting the installation.

To proceed rvm requires a ruby-1.8.7-p374 compatible ruby is installed.
We attempted to install it automatically but it failed with status 2.
Please install it manually (or a compatible alternative) to proceed.

I have tried some of the hacks suggested in Getting Ruby 1.8.7 installed on Mountain Lion (10.8) but unfortunately that didn't help. Looking further into the log file the error begins with the following message:

In file included from openssl_missing.c:22:0:
openssl_missing.h:79:35: error: macro "EVP_MD_CTX_create" passed 1 arguments, but takes just 0
 EVP_MD_CTX *EVP_MD_CTX_create(void);
                                   ^
In file included from /usr/local/opt/openssl@1.1/include/openssl/x509.h:23:0,
                 from /usr/local/opt/openssl@1.1/include/openssl/x509_vfy.h:17,
                 from openssl_missing.c:16:
/usr/local/opt/openssl@1.1/include/openssl/evp.h:501:51: error: expected declaration specifiers or '...' before '(' token
 # define EVP_MD_CTX_init(ctx)    EVP_MD_CTX_reset((ctx))

Searching for the first line of this error returned 0 results on here. Suggestions would be gratefully received.

Community
  • 1
  • 1
rwold
  • 2,216
  • 1
  • 14
  • 22
  • looks like you need to get ahold of an older version of openssl to link against – Jim Deville Mar 02 '17 at 16:46
  • 1
    @JimDeville It's a lot more complicated than that. It's highly unlikely that older version of OpenSSL will even compile, which leads to even more problems. – tadman Mar 02 '17 at 19:07

4 Answers4

6

I was able to get this working via RVM using a variant of rbenv code I found @ https://gist.github.com/davidkellis/909449e13905d8bfbd49c30d20f7fbca . I already had xcode and openssl.

rvm install 1.8.7 --with-openssl-dir=`brew --prefix openssl`
Corey Sciuto
  • 61
  • 1
  • 4
4

The latest development version of RVM should work:

rvm get head

I also updated XCode to version 8.2.1 before I upgraded RVM, if you do upgrade XCode you'll need to launch it and agree the new license or:

sudo xcodebuild -license

I had to upgrade my brew as well and do loads to get it working as it hadn't been touched for a very long time.

I'm not sure if you could just do one in isolation. Mine is up and running now.

I nuked my RVM as I had let it get out of hand. Wish I had just pruned it instead. Now to get the legacy Rails apps up and running.

Jez Caudle
  • 183
  • 1
  • 7
  • Warning: openssl 1.0.2l is already installed Warning: libyaml 0.1.7 is already installed Warning: libffi 3.2.1 is already installed apple-gcc42: This formula either does not compile or function as expected on macOS versions newer than Mavericks due to an upstream incompatibility. Error: An unsatisfied requirement failed this build. – PKul Oct 17 '17 at 13:15
  • Is that a problem with Home Brew or RVM? – Jez Caudle Nov 27 '17 at 08:56
2

Ruby 1.8.7 is dead and no longer supported on any modern macOS, so you can't install it. That version of Ruby is a historical artifact at this point, and if you really, really do need to run it, you'll either need to get a historical version of OS X, Linux or BSD which is compatible with it.

My advice is to use Vagrant to build a virtual machine that has an older version of Linux or BSD which can be used to build Ruby 1.8.7. Anything dating from 2010 or earlier will probably work, so Ubuntu 10.04 might be a good place to start.

It's worth noting that Ruby Enterprise Edition is a variant of 1.8.7 that was supported longer than MRI 1.8.7 was, so you may have more success with that version. It was discontinued in 2012.

tadman
  • 208,517
  • 23
  • 234
  • 262
  • Thanks for the suggestions. Irritatingly, it was working with my previous (otherwise dodgy) configuration. There, the difference was rvm used a workaround to avoid the space in my home directory, creating Rob.rvm in /, not /Users/Rob. Go figure... – rwold Mar 02 '17 at 22:10
  • 1
    `rvm` is a great tool but it can really run awry if you're not careful. – tadman Mar 02 '17 at 22:17
0

I ended up restoring my system using time machine. But another colleague had the same problems setting things up on a new machine, and found

rvm install ruby -v 1.8.7--autolibs=enable

helpful, if anyone else stumbles across this.

rwold
  • 2,216
  • 1
  • 14
  • 22