无法通过 Homebrew 安装 Ruby,权限被拒绝错误
Unable to install Ruby through Homebrew, Permission denied error
作为编程新手,我正在尝试使用自制软件安装 Ruby。安装一直卡在 'openssl' 阶段。这似乎取决于目录的权限:
/usr/local/etc/openssl/
这里和其他地方的在线研究指出试图通过 Homebrew 单独安装 'openssl',我已经完成并以错误结束:
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2e.yosemite.bot
Already downloaded: /Library/Caches/Homebrew/openssl-1.0.2e.yosemite.bottle.tar.gz
==> Pouring openssl-1.0.2e.yosemite.bottle.tar.gz
Error: Permission denied - /usr/local/etc/openssl/certs
Warning: Bottle installation failed: building from source.
==> Downloading https://www.openssl.org/source/openssl-1.0.2e.tar.gz
Already downloaded: /Library/Caches/Homebrew/openssl-1.0.2e.tar.gz
==> perl ./Configure --prefix=/usr/local/Cellar/openssl/1.0.2e --openssldir=/usr
==> make depend
==> make
==> make test
==> make install MANDIR=/usr/local/Cellar/openssl/1.0.2e/share/man MANSUFFIX=ssl
Last 15 lines from /Users/Joe/Library/Logs/Homebrew/openssl/05.make:
SSL_want_read.3ssl => SSL_want.3ssl
SSL_want_write.3ssl => SSL_want.3ssl
SSL_want_x509_lookup.3ssl => SSL_want.3ssl
installing man3/SSL_write.3ssl
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/certs: Permission denied
created directory `/usr/local/Cellar/openssl/1.0.2e/bin'
created directory `/usr/local/Cellar/openssl/1.0.2e/lib'
created directory `/usr/local/Cellar/openssl/1.0.2e/lib/engines'
created directory `/usr/local/Cellar/openssl/1.0.2e/lib/pkgconfig'
created directory `/usr/local/Cellar/openssl/1.0.2e/include'
created directory `/usr/local/Cellar/openssl/1.0.2e/include/openssl'
make: *** [install_sw] Error 13
所以我使用 'chown' 更改了 /openssl/ 目录的所有权并设法更进一步,但现在我遇到了这个错误:
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2e.yosemite.bot
Already downloaded: /Library/Caches/Homebrew/openssl-1.0.2e.yosemite.bottle.tar.gz
==> Pouring openssl-1.0.2e.yosemite.bottle.tar.gz
Error: Permission denied - /usr/local/etc/openssl/misc/c_hash
Warning: Bottle installation failed: building from source.
==> Downloading https://www.openssl.org/source/openssl-1.0.2e.tar.gz
Already downloaded: /Library/Caches/Homebrew/openssl-1.0.2e.tar.gz
==> perl ./Configure --prefix=/usr/local/Cellar/openssl/1.0.2e --openssldir=/usr
==> make depend
==> make
==> make test
==> make install MANDIR=/usr/local/Cellar/openssl/1.0.2e/share/man MANSUFFIX=ssl
Last 15 lines from /Users/Joe/Library/Logs/Homebrew/openssl/05.make:
*DSO_WIN32*) sfx="eay32.dll"; pfx=;; \
*) sfx=".bad";; \
esac; \
cp ${pfx}gost$sfx /usr/local/Cellar/openssl/1.0.2e/lib/engines/${pfx}gost$sfx.new; \
fi; \
chmod 555 /usr/local/Cellar/openssl/1.0.2e/lib/engines/${pfx}gost$sfx.new; \
mv -f /usr/local/Cellar/openssl/1.0.2e/lib/engines/${pfx}gost$sfx.new /usr/local/Cellar/openssl/1.0.2e/lib/engines/${pfx}gost$sfx; \
fi
installing gost
making install in apps...
installing openssl
installing CA.sh
cp: /usr/local/etc/openssl/misc/CA.sh.new: Permission denied
make[1]: *** [install] Error 1
make: *** [install_sw] Error 1
再说一次,如何处理 openssl 文件夹中的权限?
有人知道怎么改吗?
我想最让我困惑的是 MOST 我是这台计算机上的唯一用户,因此也是唯一的管理员,所以我无法理解为什么我没有权限访问任何内容?
我尝试过的另外两件事:
- 在我的命令之前使用 sudo
- 完全重新安装 OS X
提前感谢您的帮助。
仅仅成为机器上唯一的管理员用户并不意味着您使用该用户 运行 的所有命令都将 运行 具有 root 权限。即使您没有获得 GUI 登录,机器内部仍然有一个单独的 root 用户。这将是一个安全风险,它还有助于防止您通过 运行 宁一个破坏性的命令而不是在它前面拍打 sudo
不小心挂了自己。
您有两种选择来解决问题:
- 调整安装程序需要的每个目录的权限(在本例中为
/usr/local/etc/openssl/misc
)。看起来它需要基于错误的写权限。但是一旦你克服了那个特定的错误,可能会有更多的目录。
你可以这样让它完全打开:
chmod -R 777 /usr/local/etc/openssl/misc
或chown
一切只属于你自己:
chown -R "$USER":admin /usr/local
- 运行
brew
作为 root 用户(或通过 sudo
获得 root 权限)。这将要求您 chown
brew
可执行文件而不是您的用户。
作为编程新手,我正在尝试使用自制软件安装 Ruby。安装一直卡在 'openssl' 阶段。这似乎取决于目录的权限:
/usr/local/etc/openssl/
这里和其他地方的在线研究指出试图通过 Homebrew 单独安装 'openssl',我已经完成并以错误结束:
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2e.yosemite.bot
Already downloaded: /Library/Caches/Homebrew/openssl-1.0.2e.yosemite.bottle.tar.gz
==> Pouring openssl-1.0.2e.yosemite.bottle.tar.gz
Error: Permission denied - /usr/local/etc/openssl/certs
Warning: Bottle installation failed: building from source.
==> Downloading https://www.openssl.org/source/openssl-1.0.2e.tar.gz
Already downloaded: /Library/Caches/Homebrew/openssl-1.0.2e.tar.gz
==> perl ./Configure --prefix=/usr/local/Cellar/openssl/1.0.2e --openssldir=/usr
==> make depend
==> make
==> make test
==> make install MANDIR=/usr/local/Cellar/openssl/1.0.2e/share/man MANSUFFIX=ssl
Last 15 lines from /Users/Joe/Library/Logs/Homebrew/openssl/05.make:
SSL_want_read.3ssl => SSL_want.3ssl
SSL_want_write.3ssl => SSL_want.3ssl
SSL_want_x509_lookup.3ssl => SSL_want.3ssl
installing man3/SSL_write.3ssl
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/certs: Permission denied
created directory `/usr/local/Cellar/openssl/1.0.2e/bin'
created directory `/usr/local/Cellar/openssl/1.0.2e/lib'
created directory `/usr/local/Cellar/openssl/1.0.2e/lib/engines'
created directory `/usr/local/Cellar/openssl/1.0.2e/lib/pkgconfig'
created directory `/usr/local/Cellar/openssl/1.0.2e/include'
created directory `/usr/local/Cellar/openssl/1.0.2e/include/openssl'
make: *** [install_sw] Error 13
所以我使用 'chown' 更改了 /openssl/ 目录的所有权并设法更进一步,但现在我遇到了这个错误:
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2e.yosemite.bot
Already downloaded: /Library/Caches/Homebrew/openssl-1.0.2e.yosemite.bottle.tar.gz
==> Pouring openssl-1.0.2e.yosemite.bottle.tar.gz
Error: Permission denied - /usr/local/etc/openssl/misc/c_hash
Warning: Bottle installation failed: building from source.
==> Downloading https://www.openssl.org/source/openssl-1.0.2e.tar.gz
Already downloaded: /Library/Caches/Homebrew/openssl-1.0.2e.tar.gz
==> perl ./Configure --prefix=/usr/local/Cellar/openssl/1.0.2e --openssldir=/usr
==> make depend
==> make
==> make test
==> make install MANDIR=/usr/local/Cellar/openssl/1.0.2e/share/man MANSUFFIX=ssl
Last 15 lines from /Users/Joe/Library/Logs/Homebrew/openssl/05.make:
*DSO_WIN32*) sfx="eay32.dll"; pfx=;; \
*) sfx=".bad";; \
esac; \
cp ${pfx}gost$sfx /usr/local/Cellar/openssl/1.0.2e/lib/engines/${pfx}gost$sfx.new; \
fi; \
chmod 555 /usr/local/Cellar/openssl/1.0.2e/lib/engines/${pfx}gost$sfx.new; \
mv -f /usr/local/Cellar/openssl/1.0.2e/lib/engines/${pfx}gost$sfx.new /usr/local/Cellar/openssl/1.0.2e/lib/engines/${pfx}gost$sfx; \
fi
installing gost
making install in apps...
installing openssl
installing CA.sh
cp: /usr/local/etc/openssl/misc/CA.sh.new: Permission denied
make[1]: *** [install] Error 1
make: *** [install_sw] Error 1
再说一次,如何处理 openssl 文件夹中的权限?
有人知道怎么改吗?
我想最让我困惑的是 MOST 我是这台计算机上的唯一用户,因此也是唯一的管理员,所以我无法理解为什么我没有权限访问任何内容?
我尝试过的另外两件事:
- 在我的命令之前使用 sudo
- 完全重新安装 OS X
提前感谢您的帮助。
仅仅成为机器上唯一的管理员用户并不意味着您使用该用户 运行 的所有命令都将 运行 具有 root 权限。即使您没有获得 GUI 登录,机器内部仍然有一个单独的 root 用户。这将是一个安全风险,它还有助于防止您通过 运行 宁一个破坏性的命令而不是在它前面拍打 sudo
不小心挂了自己。
您有两种选择来解决问题:
- 调整安装程序需要的每个目录的权限(在本例中为
/usr/local/etc/openssl/misc
)。看起来它需要基于错误的写权限。但是一旦你克服了那个特定的错误,可能会有更多的目录。
你可以这样让它完全打开:
chmod -R 777 /usr/local/etc/openssl/misc
或chown
一切只属于你自己:
chown -R "$USER":admin /usr/local
- 运行
brew
作为 root 用户(或通过sudo
获得 root 权限)。这将要求您chown
brew
可执行文件而不是您的用户。