Mac下搭建ruby遇到openssl问题

最近刚接手了一台新MacBook pro 在搭建cocoapod中。设置ruby源的时候遇到了如下问题:

ERROR: While executing gem ... (Gem::Exception) Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources

提示很明显是OpenSSL的问题,所以所有https请求都无法执行,在设置淘宝源的时候也报这个错误。

以下讲的是基于RVM已经安装好ruby

首先安装一下openssl

1.rvm pkg install openssl

2.rvm install 2.3.0 --with-openssl-dir=/Users/milai/.rvm/usr   (加粗的代表 第一步安装openssl的文件目录)

然后就可以正常添加淘宝源了~

你可能感兴趣的:(Mac下搭建ruby遇到openssl问题)