Setup RVM, Ruby on Mac OS X Sierra: Unable to require openssl

Well I found a solution to the problem previously described. The following steps outline how it was resolved.

CleanUp

  1. Removed the installation of Homebrew via ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

  2. Removed the installation of RVM via rvm implode

Rebuild

  1. Install Homebrew using ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  2. Do integrity check on Brew using brew upgrade followed by brew doctor

  3. Install RVM (again!) using \curl -sSL https://get.rvm.io | bash -s stable
  4. Ensure that RVM knows about homebrew through the autolibs option using rvm autolibs homebrew
  5. Setup the environment variables so that we know where the openssl is installed:

    export LDFLAGS=-L/usr/local/opt/openssl/lib

    export CPPFLAGS=-I/usr/local/opt/openssl/include

    export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig

  6. Install ruby via rvm install 2.3.3 --autolibs=homebrew

Check that it Works

  1. Check that the rvm space knows about the OpenSSL certificates using rvm osx-ssl-certs status all. Running this command produced the following output: Certificates for /usr/local/etc/openssl/cert.pem: Up to date.

  2. Install rails via gem install rails

At the last step the installation succeeded and Rails was working (at last!)