Resolving rbenv build issue

Posted on Dec 10, 2023

Ruby often recieves a lot of critiscism for not being a fast language, and often consuming a large amount of system resources. Whilst this statement may be a fair assesment, there is a lot more to ruby than just pure performance.

There is a vast ecosystem and community that surround ruby; one that is rather friendly and welcoming. The like to build around this notion of developer experience and being easy to learn and use.

I rather like ruby, it feels like writing poetry instead of a program and tries to abstract away the common boilerplate.

However I am often met with frustration when trying to get the toolchain setup which makes me avoid developing in ruby as I am lazy to resolve some initial issues. For local development, I like to use rbenv which is a common tool that enables you to use multiple versions of ruby on the one machine.

Unfortunately ruby-build that is used by rbenv builds ruby with a dependency on an older version of OpenSSL (specifically v1) and it's a pain to remember the location of the dependency and how to reference it correctly.

# 1. Install dependencies with brew
brew install openssl@1
# 2. Install ruby version (at time of writing it was v3.2.2), with an environment variable to openssl@1
RUBY_CONFIGURE_OPTS=--with-openssl-dir=$(brew --prefix openssl@1.1) rbenv install 3.2.2