Skip to content

Instantly share code, notes, and snippets.

@przbadu
Created March 21, 2023 10:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save przbadu/15ecca41476cccbddf8c03e192b49677 to your computer and use it in GitHub Desktop.
Save przbadu/15ecca41476cccbddf8c03e192b49677 to your computer and use it in GitHub Desktop.

Install required brew packages

brew install openssl@1.1 readline libyaml gmp

Note openssl@1.1 and readline needs to be installed, otherwise installation will fail.

.zshrc file configurations

Add following lines to your ~/.zshrc file

# rbenv
export RBENV_ROOT=/opt/homebrew/opt/rbenv
export PATH=$RBENV_ROOT/bin:$PATH
eval "$(rbenv init -)"
# openssl
export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig"
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=/opt/homebrew/opt/openssl@1.1"

don't forget to reload your the changes source ~/.zshrc

Now install your ruby version by prefixing RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC

RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC rbenv install 2.5.8

Reference:

rbenv/ruby-build#1691 (comment)

@przbadu
Copy link
Author

przbadu commented Mar 21, 2023

If you get a dalli error, update dally gem it to 3.2.0+ and it should work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment