无法在Mac OS Catalina上安装Rails [英] Can't Install Rails on Mac OS Catalina

查看:112
本文介绍了无法在Mac OS Catalina上安装Rails的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在新的Mac机器上安装Rails v 6.1.1(仍在Catalina而不是Big Sur上)时,我收到一条错误消息,找不到解决方案.

I'm getting an error message that I can't find the solution for when I'm trying to install Rails v 6.1.1 on my new Mac machine (still on Catalina, not Big Sur)

我已经安装了rbenv和Homebrew,并已更新到最新版本的Ruby(3.0.0).当我放出哪个红宝石时,我得到:/usr/local/opt/ruby​​/bin/ruby​​

I have rbenv and Homebrew installed and have updated to the latest version of Ruby (3.0.0). When I put out which ruby I get: /usr/local/opt/ruby/bin/ruby

这是我运行 gem install rails -v 6.1.1 时在终端上看到的错误代码(与 sudo install相同的错误):

Here's the error code I'm seeing in terminal when I run gem install rails -v 6.1.1 (same error with sudo install):

 Building native extensions. This could take a while...
 ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

 current directory: /usr/local/lib/ruby/gems/3.0.0/gems/mimemagic-0.3.10/ext/mimemagic
 /usr/local/opt/ruby/bin/ruby -I/usr/local/lib/ruby/site_ruby/3.0.0 -rrubygems /usr/local/Cellar/ruby/3.0.0_1/lib/ruby/gems/3.0.0/gems/rake-13.0.3/exe/rake RUBYARCHDIR\=/usr/local/lib/ruby/gems/3.0.0/extensions/x86_64-darwin-19/3.0.0/mimemagic-0.3.10 RUBYLIBDIR\=/usr/local/lib/ruby/gems/3.0.0/extensions/x86_64-darwin-19/3.0.0/mimemagic-0.3.10
 rake aborted!
 Could not find MIME type database in the following locations: ["/usr/local/share/mime/packages/freedesktop.org.xml", "/opt/homebrew/share/mime/packages/freedesktop.org.xml", "/opt/local/share/mime/packages/freedesktop.org.xml", "/usr/share/mime/packages/freedesktop.org.xml"]

 Ensure you have either installed the shared-mime-info package for your distribution, or
 obtain a version of freedesktop.org.xml and set FREEDESKTOP_MIME_TYPES_PATH to the location of that file.

 This gem might be installed as a dependency of some bigger package, such as rails, activestorage, axlsx or cucumber. While most of these packages use the functionality of this gem, some gems have included this gem by accident. Set USE_FREEDESKTOP_PLACEHOLDER=true if you are certain that you do not need this gem, and wish to skip the inclusion of freedesktop.org.xml.

 The FREEDESKTOP_PLACEHOLDER option is meant as a transitional feature, and will be deprecated in the next release.
 /usr/local/lib/ruby/gems/3.0.0/gems/mimemagic-0.3.10/ext/mimemagic/Rakefile:15:in `locate_mime_database'
 /usr/local/lib/ruby/gems/3.0.0/gems/mimemagic-0.3.10/ext/mimemagic/Rakefile:39:in `block in <top (required)>'
 Tasks: TOP => default
 (See full trace by running task with --trace)

 rake failed, exit code 1

 Gem files will remain installed in /usr/local/lib/ruby/gems/3.0.0/gems/mimemagic-0.3.10 for inspection.
 Results logged to /usr/local/lib/ruby/gems/3.0.0/extensions/x86_64-darwin-19/3.0.0/mimemagic-0.3.10/gem_make.out

推荐答案

如果您想为自己安装 brew ,并且尚未在其中更新 brew 同时,我建议运行:

If you want to have brew install this for you and you haven't updated brew in a while, I would recommend running:

HOMEBREW_NO_AUTO_UPDATE=1 brew install shared-mime-info

我刚跑完

brew install shared-mime-info

它更新了我不想要的一堆软件包,并破坏了我的ruby安装.

And it updated a bunch of packages I didn't want it to and broke my ruby installation.

我也喜欢斯派克曼的解决方案.这似乎是软件包维护者想要您做的事情.

I like spickermann's solution too. It seems to be what the package maintainers want you to do.

这篇关于无法在Mac OS Catalina上安装Rails的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆