Last Updated: February 25, 2016
·
1.393K
· dfang

Install ruby failed on el capitan

El Capitan 上用brew 安装ruby的时候,碰到此错误
```
brew install rbenv ruby-build
rbenv install 2.2.2

will failed with this error,

Results logged to /var/folders/ys/0h6glx5s3gj00zv0p6w3rhy00000gn/T/ruby-build.20150904110309.45724.log

Last 10 log lines:
The Ruby openssl extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
--prefix=/Users/dfang/.rbenv/versions/2.2.3
--with-readline-dir=/usr/local/opt/readline
--with-openssl-dir=/usr/local/opt/openssl
CC=clang
CFLAGS= -O3 -Wno-error=shorten-64-to-32
LDFLAGS=-L/Users/dfang/.rbenv/versions/2.2.3/lib
CPPFLAGS=-I/Users/dfang/.rbenv/versions/2.2.3/include
```

CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline) --with-openssl-dir=$(brew --prefix openssl)" rbenv install -k -v 2.2.2 does not work.

you just need to link openssl brew link --force openssl

and also it's better to install ruby build this way instead of brew install ruby-build
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

links:

http://www.extendi.it/blog/2014/3/27/26-the-ruby-openssl-extension-was-not-compiled-missing-the-openssl-lib

http://www.extendi.it/blog/2014/3/27/26-the-ruby-openssl-extension-was-not-compiled-missing-the-openssl-lib

https://ruby-china.org/topics/16073

https://github.com/sstephenson/ruby-build/issues/377

https://github.com/sstephenson/ruby-build/issues/606