0
votes

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

I made sure I have ruby - 2.6 version also nodes, yarn, home-brew, and sqlite3

cant figure out what I'm doing wrong tried both sudo gem install rails and gem install rails I'm using a new Mac book pro

2
Nooooooooooo! Nooooooo! Noooo! Throwing sudo at any random command that fails is not the answer. This is Apple's Ruby installation. It is only for internal use by Apple. Do not change its permissions. Do not use sudo. Simply do not use it at all. - Jörg W Mittag
so how do I download rails then? - Michaela Lewis

2 Answers

2
votes

There are a couple of different Ruby version managers that can be used to install Ruby on macOS like

You might want to read their documentation to understand the differences between them and to choose the manager that fits your needs best. The topic is quite opinionated.

Using a version manage has the advantage that you do not depend on the Ruby version installed and used by macOS internally that is on the one hand a bit outdated and on the other hand might change in the future. And it allows you to install multiple different versions at the same time on your machine which is handy when you work on different projects which require different versions or when you are upgrading your apps to a new version in the future.

1
votes

You should use RVM to install ruby then (without sudo): gem install rails