As you progress through the rails tutorial, record the errors that occurred. Hardware uses MacBook Air, and development environment uses VScode.
rails Tutorial Chapter 1 1.2.2 Installing Rails
As of 2020.7, rails6 is the latest version, but the free version of the rails tutorial supports rails5, so install rails5.
**ruby is installed using the gem command. **
$ gem install rails -v 5.1.6
As for where to run gem install, I ran it in my home directory. (Running $ cd ~ or cd will get you there.) After some digging, I couldn’t find an article describing where it did: sob:
** Do you know the engineer? ‥ Trivia Corner** Where is **gem? I think that many people feel **. I am also one of them. When I looked it up, it says “gem is a ruby package (library).” A gem is a container that can contain various functions such as rails as a set, and this time I am vaguely thinking that I will put rails there. (If it is wrong, please point it out.) (Reference: https://techplay.jp/column/529)
If you go back and run the previous command, you’ll get the following error:
$ gem install rails -v 5.1.6 ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.
It’s **not authorized! The error is **.
MacOS has the function that only the user who has the authority as the administrator can change the system seriously. An error has occurred because it is blocked by this.
So, add the command **sudo. **
$ sudo gem install rails -v 5.1.6
If the user who executed the command on the Mac has administrator privileges **determined by **sudo command (whether the account has a password set) , The command will be executed.
At that time, you will be asked to enter the password. *Let’s enter the password for logging in to the computer. **
Installation is completed successfully!
If you find it useful, please feel free to press the LGTM button. ** Learn Rails together Let’s do our best! :raised_hand_tone1: