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

时间:2018-03-02 12:27:11

标签: ruby homebrew macos-high-sierra dyld

我在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。

任何帮助?

2 个答案:

答案 0 :(得分:1)

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

首先,您需要从Thread.interrupted()下载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。

答案 1 :(得分:0)

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

,RVM需要Homebrew