Overcoming Ruby Error digest/sha1.bundle Library not loaded.

I ran into trouble the other day running rspec on my project. It had been working just fine the day before, but all of a sudden:

/Users/mburke/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/i686-darwin12.3.0/digest/sha1.bundle: dlopen(/Users/mburke/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/i686-darwin12.3.0/digest/sha1.bundle, 9): Library not loaded: /opt/local/lib/libcrypto.1.0.0.dylib (LoadError) ..snip ..

From what I could Google up, this happens when ruby is missing an OpenSSL dependency. Then I remembered that yesterday in a fit of irrational rage I had removed MacPorts. MacPorts supplied the OpenSSL library that my ruby installation was linked against (notice Ruby was looking in /opt/local/ which is where MacPorts installs things)

Luckily, RVM now has the ability to install dependencies automatically:

Terminal
#update rvm itself $ rvm get head #tell RVM to use homebrew as its package manager $ rvm autolibs homebrew #enable auotolibs in full auto mode $ rvm autolibs enable # reinstall ruby $ rvm reinstall ruby-1.8.7-p302

I will probably have to do the last line for each ruby version I have installed.

I did get an error:

Installing required custom packages: homebrew/versions homebrew/versions.... Error running 'requirements_osx_brew_install_custom homebrew/versions homebrew/versions', please read /Users/mburke/.rvm/log/1378383360_ruby-1.8.7-p302/install_custom.log Requirements installation failed with status: 1.

But checking the log yielded

Terminal
$ cat /Users/mburke/.rvm/log/1378383360_ruby-1.8.7-p302/install_custom.log [2013-09-05 08:16:16] requirements_osx_brew_install_custom requirements_osx_brew_install_custom () { typeset __tap; for __tap in "$@"; do brew tap "${__tap}" || return $?; done } current path: /Users/mburke/personal/efh/server command(3): requirements_osx_brew_install_custom homebrew/versions homebrew/versions Cloning into '/usr/local/Library/Taps/homebrew-versions'... Checking connectivity... done Tapped 104 formula Error: Already tapped!

That doesn’t seem like an error, but whatever. So I just ran the command again. Now my machine is happily compiling and installing gcc46 and openssl1098. Soon a fixed ruby install will be available.