I'm tryng to install rails with gem install rails
but when I try that I get
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
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:
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. Unfortunately, most solutions are incomplete, outdated, and provide bad advice. You should never need to use sudo
or change permissions.
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 . 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
.
TL;DR: Use a battle-tested and reliable automated script that will set everything up for you: https://github.com/monfresh/laptop
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.