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

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 在Mac OS上安装Rails失败,出现多个错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试在我的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$

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

> http://rubyonrails.org/download/
> Installing gem or updating RubyGems fails with permissions error
> https://github.com/sstephenson/rbenv/
> https://gorails.com/setup/osx/10.10-yosemite
> Missing the OpenSSL lib?

解决方法

首先运行此命令
sudo chown -R <your username>:admin /usr/local

替换<您的用户名>用你Mac上的用户名是什么.所以,就我而言,我会跑

sudo chown -R Adrian:admin /usr/local

然后尝试安装rbenv和ruby-build.

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

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

原文链接:https://www.f2er.com/ruby/264485.html

猜你在找的Ruby相关文章