Search code examples
rubymacosopensslrbenv

Ruby 2.6.0 installation fails on MacOS with rbenv


I have a Mac on Mojave, and it's failing to install some of the basic stuff required for development:

$ rbenv install 2.6.0

Downloading openssl-1.1.1d.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/1e3a91bc1f9dfce01af26026f856e064eab4c8ee0a8f457b5ae30b40b8b711f2
Installing openssl-1.1.1d...

BUILD FAILED (OS X 10.14.6 using ruby-build 20191223)

Inspect or clean up the working tree at /var/folders/l_/xgbzwc3j0xn_cb74550m71vr0000gn/T/ruby-build.20191225225406.18503.lq8QNM
Results logged to /var/folders/l_/xgbzwc3j0xn_cb74550m71vr0000gn/T/ruby-build.20191225225406.18503.log

Last 10 log lines:
      _s_server_main in s_server.o
  "_verify_stateless_cookie_callback", referenced from:
      _s_server_main in s_server.o
  "_wait_for_async", referenced from:
      _s_client_main in s_client.o
      _sv_body in s_server.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [apps/openssl] Error 1
make: *** [all] Error 2

I found several blogposts talking about how the Mojave release has broken a few things for developers, but none of the articles provide a solution. Has anyone else faced the issue described above?


Solution

  • Reposting my response from this other thread - I was facing a similar issue and can recommend the approach below that's related to binutils needing to be uninstalled first. What worked for me:

    brew uninstall binutils
    # Uninstalling /usr/local/Cellar/binutils/2.33.1... (134 files, 167.6MB)
    
    rbenv install 2.6.5 && rbenv local 2.6.5 ;
    # Downloading openssl-1.1.1d.tar.gz...
    # -> https://dqw8nmjcqpjn7.cloudfront.net/1e3a91bc1f9dfce01af26026f856e064eab4c8ee0a8f457b5ae30b40b8b711f2
    # Installing openssl-1.1.1d...
    # Installed openssl-1.1.1d to /Users/auser/.rbenv/versions/2.6.5
    
    # Downloading ruby-2.6.5.tar.bz2...
    # -> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.bz2
    # Installing ruby-2.6.5...
    # ruby-build: using readline from homebrew
    # Installed ruby-2.6.5 to /Users/auser/.rbenv/versions/2.6.5
    

    Prior to this the I was also getting a number of varying messages in ruby-build.log - with the last being:

    # ld: symbol(s) not found for architecture x86_64
    

    A number of other steps that I took as part of my homebrew setup (prior to uninstall) included:

    brew install perl ruby rbenv
    # // UPDATE PATHs with suggestions made by brew during install
    which awk perl
    # /usr/local/bin/awk
    # /usr/local/bin/perl
    # ^^^ IN SHORT ALL PATHs should be with /usr/local/opt OR /usr/local/bin
    

    You can re-install binutils again after as needed and remember to repeat the uninstallation with any future rbenv install version(s) that you're likely to re-execute (note to self).

    PS - tested on macOS Catalina 10.15.3 (19D76) successfully installing both 2.4.0 & 2.6.5