简体   繁体   English

试图在导轨上安装 ruby

[英]Trying to install ruby on rails

I'm tryng to install rails with gem install rails but when I try that I get我正在尝试使用gem install rails但是当我尝试时我得到了

ERROR: While executing gem... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

So I tried using sudo gem install rails and I get所以我尝试使用sudo gem install rails ,我得到了

ERROR:  Error installing rails:
ERROR: Failed to build gem native extension.

I've checked on the internet and it says I should install RVM but when I try to do that it tells me:我在网上查了一下,它说我应该安装 RVM,但是当我尝试这样做时,它告诉我:

Error running './configure --prefix=/Users/manhattan/.rvm/rubies/ruby-2.7.0 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/libksba:/usr/local/opt/readline:/usr/local/opt/zlib:/usr/local/opt/openssl@1.1 --disable-install-doc --enable-shared', please read /Users/manhattan/.rvm/log/1589107425_ruby-2.7.0/configure.log There has been an error while running configure. Halting the installation.

Could someone help me please.有人可以帮我吗。

you can change the permission of the directory you are working on您可以更改您正在处理的目录的权限

# chmod -R 777 DIR_NAME
# cd DIR_NAME
# gem install rails

Installing Ruby gems (like Rails) on a Mac is a common source of confusion and frustration.在 Mac 上安装 Ruby gems(如 Rails)是一个常见的困惑和挫折源。 Unfortunately, most solutions are incomplete, outdated, and provide bad advice.不幸的是,大多数解决方案都是不完整的、过时的,并且提供了不好的建议。 You should never need to use sudo or change permissions.您永远不需要使用sudo或更改权限。

There are 5 steps to a working Ruby setup, which I've written about in a lot of detail in my definitive guide to installing Ruby gems on a Mac .一个有效的 Ruby 设置有 5 个步骤,我在我的在 Mac 上安装 Ruby gems 的权威指南中有很多详细的描述。 It explains why you are getting these errors, compares the various solutions, why some are better than others, and why you shouldn't use sudo .它解释了为什么会出现这些错误,比较各种解决方案,为什么有些解决方案比其他解决方案更好,以及为什么不应该使用sudo

TL;DR: Use a battle-tested and reliable automated script that will set everything up for you: https://github.com/monfresh/laptop TL;DR:使用经过实战考验且可靠的自动化脚本,将为您设置一切: https://github.com/monfresh/laptop

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM