问题描述
我正在尝试在Mac OS v10.10.4系统上安装Rails,并且在运行brew install rbenv ruby-build
时失败.错误是:
I am trying to install Rails on my Mac OS v10.10.4 system, and it fails when I run brew install rbenv ruby-build
. The error is:
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
这是我在这次尝试中尝试的所有内容的完整日志:
Here is the complete log of all what I tried during this attempt:
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$
到目前为止,我已经查看了以下链接:
I have looked at the folllowing links so far:
- http://rubyonrails.org/download/
- 安装gem或更新RubyGems失败,并出现权限错误
- https://github.com/sstephenson/rbenv/
- https://gorails.com/setup/osx/10.10-yosemite
- 缺少OpenSSL库吗?
- 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上的用户名替换<your username>
.因此,就我而言,我会跑步
Replace <your username>
with whatever your username on your mac is. So, in my case, I would run
sudo chown -R Adrian:admin /usr/local
然后尝试安装rbenv和ruby-build.
Then try installing rbenv and ruby-build.
您的问题很可能是由使用软件包安装程序(.pkg文件)引起的,因为它们倾向于在不应该安装的地方以root用户身份创建文件.
Your problem is most likely caused by the use of package installers (.pkg files) as they tend to create files as root in places where they shouldn't.
注意:您可以通过运行whoami
Note: you can find out your username by running whoami
这篇关于在Mac OS上安装Rails失败,出现几个错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!