ruby-on-rails - 在 Mac OS 上安装 Rails 失败并出现多个错误

标签 ruby-on-rails ruby ssl homebrew rbenv

我正在尝试在我的 Mac OS v10.10.4 系统上安装 Rails,但当我运行 brew install rbenv ruby​​-build 时它失败了。错误是:

Error: Permission denied - /usr/local/etc/openssl
Warning: Bottle installation failed: building from source.

在过程结束时它说:

installing man3/d2i_SSL_SESSION.3ssl
i2d_SSL_SESSION.3ssl => d2i_SSL_SESSION.3ssl
installing man3/ssl.3ssl
Cannot create directory /usr/local/etc/openssl: Permission denied

这是我在这次尝试中尝试过的所有内容的完整日志:

Mac-213978b7b1793718b9:ROR developer$ brew install rbenv ruby-build
Warning: rbenv-0.4.0 already installed
==> Installing ruby-build dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2d_1.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.2d_1.yosemite.bottle.tar.gz
Error: Permission denied - /usr/local/etc/openssl
Warning: Bottle installation failed: building from source.
==> Downloading https://www.openssl.org/source/openssl-1.0.2d.tar.gz
######################################################################## 100.0%
==> perl ./Configure --prefix=/usr/local/Cellar/openssl/1.0.2d_1 --openssldir=/usr/local/etc/openssl no-ssl2 zlib-dynamic shared enable-cms darw
==> make depend
==> make
==> make test
==> make install MANDIR=/usr/local/Cellar/openssl/1.0.2d_1/share/man MANSUFFIX=ssl
installing man3/d2i_SSL_SESSION.3ssl
i2d_SSL_SESSION.3ssl => d2i_SSL_SESSION.3ssl
installing man3/ssl.3ssl
Cannot create directory /usr/local/etc/openssl: Permission denied
make: *** [install_sw] Error 13

READ THIS: https://git.io/brew-troubleshooting

These open issues may also help:
Installing Elixir fails due to OpenSSL errors. https://github.com/Homebrew/homebrew/issues/33218
Mac-213978b7b1793718b9:ROR developer$ rbenv install --patch 2.1.1
rbenv: no such command `install`
Mac-406c8f4772a8:ROR developer$ rbenv instal --patch 2.1.1
rbenv: no such command `instal`
Mac-406c8f4772a8:ROR developer$ brew install --HEAD ruby-build
==> Installing ruby-build dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2d_1.yosemite.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/openssl-1.0.2d_1.yosemite.bottle.tar.gz
==> Pouring openssl-1.0.2d_1.yosemite.bottle.tar.gz
Error: Permission denied - /usr/local/etc/openssl
Warning: Bottle installation failed: building from source.
==> Downloading https://www.openssl.org/source/openssl-1.0.2d.tar.gz
Already downloaded: /Library/Caches/Homebrew/openssl-1.0.2d.tar.gz
==> perl ./Configure --prefix=/usr/local/Cellar/openssl/1.0.2d_1 --openssldir=/usr/local/etc/openssl no-ssl2 zlib-dynamic shared enable-cms darw
==> make depend
==> make
brew install rbenv ruby-build==> make test
==> make install MANDIR=/usr/local/Cellar/openssl/1.0.2d_1/share/man MANSUFFIX=ssl
installing man3/d2i_SSL_SESSION.3ssl
i2d_SSL_SESSION.3ssl => d2i_SSL_SESSION.3ssl
installing man3/ssl.3ssl
Cannot create directory /usr/local/etc/openssl: Permission denied
make: *** [install_sw] Error 13

READ THIS: https://git.io/brew-troubleshooting

These open issues may also help:
Installing Elixir fails due to OpenSSL errors. https://github.com/Homebrew/homebrew/issues/33218
Mac-213978b7b1793718b9:ROR developer$ brew install rbenv ruby-build
Warning: rbenv-0.4.0 already installed
==> Installing ruby-build dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2d_1.yosemite.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/openssl-1.0.2d_1.yosemite.bottle.tar.gz
==> Pouring openssl-1.0.2d_1.yosemite.bottle.tar.gz
Error: Permission denied - /usr/local/etc/openssl
Warning: Bottle installation failed: building from source.
==> Downloading https://www.openssl.org/source/openssl-1.0.2d.tar.gz
Already downloaded: /Library/Caches/Homebrew/openssl-1.0.2d.tar.gz
==> perl ./Configure --prefix=/usr/local/Cellar/openssl/1.0.2d_1 --openssldir=/usr/local/etc/openssl no-ssl2 zlib-dynamic shared enable-cms darw
^Z
[1]+  Stopped                 brew install rbenv ruby-build
Mac-213978b7b1793718b9:ROR developer$ curl https://gist.githubusercontent.com/andschwa/11334511/raw/563d5c2efb869cafb0c65404d12243822bba2817/ruby-2.1.1-readline.patch | rbenv install --patch 2.1.1
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0rbenv: no such command `install'
100  1713  100  1713    0     0   1499      0  0:00:01  0:00:01 --:--:--  1498
(23) Failed writing body
Mac-213978b7b1793718b9:ROR developer$

到目前为止,我已经查看了以下链接:

最佳答案

先运行这条命令

sudo chown -R <your username>:admin /usr/local

替换<your username>无论您在 Mac 上的用户名是什么。所以,就我而言,我会跑

sudo chown -R Adrian:admin /usr/local

然后尝试安装 rbenv 和 ruby​​-build。

您的问题很可能是由于使用包安装程序(.pkg 文件)引起的,因为它们倾向于在不应创建的地方以 root 身份创建文件。

注意:您可以通过运行 whoami 找到您的用户名

关于ruby-on-rails - 在 Mac OS 上安装 Rails 失败并出现多个错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31777019/

相关文章:

ruby-on-rails - 收款人…………不接受以这种货币支付的款项

ruby-on-rails - 如何更改ActiveAdmin密码?

ruby-on-rails - 使用 friendly_id 一段时间后启用历史记录

mysql - 哈希未插入数据库

ruby - 为什么单例类是它自己的一个实例?

perl - WWW::Mechanize 突然看不到https网页

ruby-on-rails - rspec 中的 subject.invoke 是什么?

java - Glassfish v4 和 SSL - 管理员不再工作

c++ - 初始化 SSL 和 libcurl 并获取 "out of memory"

javascript - JPlayer on Rails