无法在OS X上安装自制软件或更新Ruby

问题描述 投票:3回答:2

我在OS X上安装Homebrew时遇到问题。操作系统版本是High Sierra 10.13.3

试图运行:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

它返回:

dyld: Library not loaded: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/libruby.2.3.0.dylib
Referenced from: /usr/bin/ruby
Reason: Incompatible library version: ruby requires version 2.3.3 or later, but libruby.2.3.0.dylib provides version 2.3.0
Abort trap: 6

人们说通过rvm或rbenv更新Ruby,但没有成功。

试试这个:

\curl -sSL https://get.rvm.io | bash -s stable
Downloading https://github.com/rvm/rvm/archive/1.29.3.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.3/1.29.3.tar.gz.asc
Found PGP signature at: 'https://github.com/rvm/rvm/releases/download/1.29.3/1.29.3.tar.gz.asc',
but no GPG software exists to validate it, skipping.

Upgrading the RVM installation in /Users/m1-user/.rvm/
RVM PATH line found in /Users/m1-user/.mkshrc /Users/m1-user/.profile /Users/mm-user/.bashrc /Users/mm-user/.zshrc.
RVM sourcing line found in /Users/m1-user/.profile /Users/mm-user/.zlogin.
RVM sourcing line not found for Bash, rerun this command with '--auto-dotfiles' flag to fix it.
Upgrade of RVM in /Users/m1-user/.rvm/ is complete.

Upgrade Notes:

  * No new notes to display.

之后:

$ rvm install ruby-2.4.1
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.13/x86_64/ruby-2.4.1.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
About to install Homebrew, press `Enter` for default installation in `/usr/local`,
type new path if you wish custom Homebrew installation (the path needs to be writable for user)
: 
dyld: Library not loaded: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/libruby.2.3.0.dylib
Referenced from: /usr/bin/ruby
Reason: Incompatible library version: ruby requires version 2.3.3 or later, but libruby.2.3.0.dylib provides version 2.3.0
Requirements installation failed with status: 134.

所以它就像一个恶性循环:我无法安装自制软件因为ruby旧版本,我无法更新ruby,因为我需要安装自制软件。

有帮助吗?

ruby homebrew macos-high-sierra dyld
2个回答
1
投票

经过大量的搜索,我找不到合适的解决方案。但我试图通过自己编译来更新Ruby。它对我有用。所以也许它也会对某人有所帮助。

首先,您需要从https://www.ruby-lang.org/en/downloads/下载Ruby源代码您可以选择任何稳定版本。我下载了2.5.0。

然后解压缩归档并将其复制到Ruby文件夹:

# Replace path below to correct path to extracted folder
sudo cp -r /Users/your-user/Downloads/ruby-2.5.0 /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/

然后将目录更改为复制的文件夹:

cd /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/ruby-2.5.0

然后你应该通过运行下一个命令来编译它:

sudo ./configure
sudo make
sudo make install

然后,您可以列出可用的Ruby版本并选择一个安装:

# Will list available versions
rvm list known
# Choose from available and install it
rvm install ruby-2.4.1

之后,Homebrew成功安装。


0
投票

听起来你需要卸载ruby然后尝试安装Homebrew。一旦Homebrew工作,你可以重新安装ruby。根据这个http://railsapps.github.io/installrubyonrails-mac.html,RVM需要Homebrew

© www.soinside.com 2019 - 2024. All rights reserved.