在 OSX 上使用 RVM 安装任何 ruby​​ 版本时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16632543/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 05:58:10  来源:igfitidea点击:

Error installing any ruby version with RVM on OSX

rubyerror-handlingterminalinstallationrvm

提问by The Whiz of Oz

Guys I'm about to kill myself with this one!

伙计们,我要用这个自杀了!

I had some problems with RVM installing multiple versions of Ruby, and following a thread on Stackoverflow I decided to remove it completely. After reinstalling RVM, I am unable to install any Ruby version at all.

我在 RVM 安装多个版本的 Ruby 时遇到了一些问题,并且按照 Stackoverflow 上的一个线程我决定完全删除它。重新安装 RVM 后,我根本无法安装任何 Ruby 版本。

  • Mac OS X
  • RVM 1.20.10 stable
  • Homebrew 0.9.4
  • Mac OS X
  • RVM 1.20.10 稳定
  • 自制 0.9.4

Here are some logs:

以下是一些日志:

rvm install 2.0.0-p0

rvm 安装 2.0.0-p0

or:

或者:

rvm install 2.0.0-p195 --autolibs=enabled

rvm 安装 2.0.0-p195 --autolibs=enabled

Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-2.0.0-p0.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Installing requirements for osx, might require sudo password.
Already up-to-date.
Installing required packages: autoconf, automake, libtool, pkg-config, libyaml, readline, libxml2, libxslt, libksba, openssl…
Error running 'requirements_osx_brew_libs_install autoconf automake libtool pkg-config libyaml readline libxml2 libxslt libksba openssl',
please read /Users/admin/.rvm/log/ruby-2.0.0-p0/1368903329_package_install_autoconf_automake_libtool_pkg-config_libyaml_readline_libxml2_libxslt_libksba_openssl.log

Logfile reads:

日志文件如下:

[2013-05-18 22:55:29] requirements_osx_brew_libs_install
Error: No such keg: /usr/local/Cellar/autoconf
There were package installation errors, make sure to read the log.
Check Homebrew requirements github.com/mxcl/homebrew/wiki/Installation

brew doctor

酿造医生

Your system is ready to brew.

brew cleanup

酿造清理

Removing: /Library/Caches/Homebrew/automake-1.13.1.tar.gz…
Error: Permission denied — /Library/Caches/Homebrew/automake-1.13.1.tar.gz

brew reinstall autoconf

brew 重新安装 autoconf

Error: No such keg: /usr/local/Cellar/autoconf

Help!

帮助!

回答by rlorenzo

I ran into the same issue, you need to manually install all the required packages using Brew. For me I had to run the following installs:

我遇到了同样的问题,您需要使用 Brew 手动安装所有必需的软件包。对我来说,我必须运行以下安装:

brew install autoconf
brew install automake
brew install libtool
brew install apple-gcc42
brew install libyaml
brew install libxslt
brew install libksba
brew install openssl

You just need to keep running "rvm requirements" and reading the log and installing the packages needed until there are no more errors.

您只需要继续运行“rvm 要求”并阅读日志并安装所需的包,直到不再出现错误。

回答by fengd

After installing RVM, You'll want to run

安装 RVM 后,您需要运行

rvm requirements

to see if anything else is required to install ruby and rails first.

先看看是否需要其他任何东西来安装 ruby​​ 和 rails。

here is the similar question asked rvm install ruby

这是rvm install ruby提出的类似问题

回答by Tejasvi Manmatha

This solved problem for me

这为我解决了问题

sudo chown -R `whoami` /Library/Caches/Homebrew/
sudo chown -R `whoami` /Library/Caches/Homebrew/

回答by luba

I aswell ran into the permission problem. My /usr/local/opt where the packages are linked had permissions root:wheel. I changed permissions by doing

我也遇到了权限问题。我的 /usr/local/opt 链接包的地方有 root:wheel 权限。我通过做改变了权限

sudo chown -R <localuser>:staff /usr/local/opt

where of course "localuser" is your local user you used to install brew.

当然,“localuser”是您用来安装 brew 的本地用户。

Then aswell I had to run

然后我不得不跑

brew reinstall autoconf

and so on instead of just "install", since brew always kept on saying the lib already was installed (yet not linked). "reinstall" simply forces a new install of the package. that did the trick for me.

等等,而不仅仅是“安装”,因为 brew 总是一直说已经安装了 lib(但尚未链接)。“重新安装”只是强制重新安装软件包。这对我有用。

Hope this helps someone with similar problems.

希望这可以帮助有类似问题的人。

回答by Jishnu

User which is running brew should have write access to This entire directory path

运行 brew 的用户应该对整个目录路径具有写访问权限

/Library/Caches/Homebrew/Formula

/图书馆/缓存/自制软件/公式

No need to change ownership just write permission. then running rvm works

无需更改所有权,只需写入权限。然后运行 ​​rvm 工作

回答by Philip O'Brien

I was encountering similar issues, particular around the install of openssl098. I came across this Homebrew issue, tried rvm get headas suggested, and now rvm works perfectly.

我遇到了类似的问题,特别是在安装 openssl098 时。我遇到了这个 Homebrew 问题rvm get head按照建议进行了尝试,现在 rvm 完美运行。

回答by Artem Kirillov

I'd try to install Xcode Command Line Tools before.

我之前尝试安装 Xcode 命令行工具。

回答by Scorpiuszjj

Try

尝试

rvm reinstall ruby-2.3.1 --with-openssl-dir=`brew --prefix openssl`

rvm openssl on Mojave

Mojave 上的 rvm openssl

回答by Matt Frear

I had the same problem

我有同样的问题

brew install pkg-config

worked for me

对我来说有效