Rails environment construction Rails5.2.1 ruby2.5.1 Catalina

This is the first post in a long time.

I attended a tech camp in September 2019 and started working for a Rails in-house development company in July 2020! It took a while, but on the first day of my long-awaited engineer debut, I had a hard time building the environment for the supplied MacBook, so I will record it.

Development environment

Rails 5.2.1 Ruby 2.5.1 MacOS Catalina10.15.6

Since I don't use Docker, I packed it from Ruby from an editor into a completely initial PC. This is the end of the day.

What I had a hard time

--Introduction of command line tools --Ruby version setting --MacOS compatibility (personally use mojave) --Understanding rbenv

At the basic stage of learning, the environment was built with the tech camp curriculum, so it took quite a while to build the environment on my own from scratch. It was a good review.

command line tools The command line tool is a "program that operates only with the keyboard". In short, it's a command to type from the terminal.

Install the Xcode "command line tools".

Terminal


$ xcode-select --install

There is an article that you do not need to install Xcode itself, but in my environment Xcode itself also needed to be installed.

If you can confirm the version with this command, the installation is successful

Terminal


$ xcodebuild -version

Error encountered

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory 
'/Library/Developer/CommandLineTools' is a command line tools instance

This is the error I encountered before installing Xcode itself

After installing Xcode itself, I solved it with the command ↓.

Terminal


sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

It looks like a command to switch to Xcode command line tools.

Reference article 1 Reference article 2

Ruby version setting

I wasn't really aware of it when I was learning, but Ruby version control is done with rbenv. A tool for managing multiple Ruby versions.

Install with homebrew.

Terminal


#rbenv installation
$ brew install rbenv ruby-build

Next, I will make it usable with bash, but in MacOS Catalina, the default login shell is zsh. It was bash in mojave.

Since there are still more materials in bash, I switched the login shell to bash here.

The login shell is the shell that is set immediately after login.

Switching command

Terminal


#Check available shells
$ cat /etc/shells

#switching
$ chsh

#Since vim opens, modify the file.
  

Reference article

In Catalina, the terminal is marked with%. In mojave, it is $ notation.

I was impatient.

I've only used bash so far, and since bash has more Japanese materials, I switched zsh to bash, but I saw an article that zsh is upward compatible with bash. I feel that a warning has been issued at the terminal as well.

I think it's better to get used to zsh as soon as possible.

Then pass the path so that you can use the command in bash.

Terminal


$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc

$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

$ source ~/.bash_profile

Now you can use rbenv.

After that, I will finally install Ruby, Rails, and DB, but I will omit it because there was no particular point to get stuck. I referred to this article.

that's all. Thank you for your relationship!

Recommended Posts

Rails environment construction Rails5.2.1 ruby2.5.1 Catalina
Ruby on Rails 6.0 environment construction memo
Rails Docker environment construction
Muscle Ruby on Rails Day 1 ~ Environment Construction ~
[Personal memo] Ruby on Rails environment construction (Windows)
[Docker] Rails 5.2 environment construction with docker
Offline environment construction Ruby edition
[Super easy] Ruby environment construction
[Rails / MySQL] Mac environment construction
Deploy to Ruby on Rails Elastic beanstalk (Environment construction)
[Environment construction Mac] Ruby on Rails (+ Webpacker handles errors)
Ruby environment construction summary ~ mac version ~
[Environment construction with Docker] Rails 6 & MySQL 8
Troublesome Rails environment construction flow [Windows 10]
[Rails] AWS EC2 instance environment construction
[Procedure 1 for beginners] Ruby on Rails: Construction of development environment
Ruby on Rails development environment construction with Docker + VSCode (Remote Container)
[Java] Environment construction
Rails API server environment construction using docker-compose
[Spring] Environment construction
Rails & React & Webpacker & MySQL Environment Construction Manual
[Error] Switch environment construction to use Ruby on Rails oss (open source)
How to solve the local environment construction of Ruby on Rails (MAC)!
How to link Rails6 Vue (from environment construction)
Ruby on Rails Elementary
java development environment construction
Ruby On Rails Association
Build a Ruby on Rails development environment on AWS Cloud9
Stable development environment construction manual for "Rails6" with "Docker-compose"
Environment construction of Rails5 + MySQL8.0 + top-level volumes with docker-compose
[Ruby on Rails] From MySQL construction to database change
Rails6 (MySQL, Ubuntu environment, Cloud9)
Ruby on rails learning record -2020.10.04
[Ruby on Rails] Debug (binding.pry)
Ruby on rails learning record -2020.10.05
Ruby on rails learning record -2020.10.09
Introduction to Metabase ~ Environment Construction ~
Update Ruby in Unicorn environment
Ruby on rails learning record-2020.10.07 ②
[Environment variables] What are rails environment variables?
JavaFX environment construction in Java 13
Install Rails on macOS Catalina
AtCoder Challenge Environment Construction (Java 8)
Rails application development environment construction with Docker [Docker, Rails, Puma, Nginx, MySQL]
[Rails Tutorial Chapter 4] Rails-flavored Ruby
Ruby on rails learning record-2020.10.07 ①
Cancel Ruby on Rails migration
Docker × Spring Boot environment construction
Ruby on rails learning record -2020.10.06
Ruby ① Build a Windows environment
Ruby on Rails validation summary
Offline environment construction CentOS edition
Ruby on Rails Basic Memorandum
Build a development environment where Ruby on Rails breakpoints work on Windows
"Rails 6 x MySQL 8" Docker environment construction procedure for sharing with teams
Steps to build a Ruby on Rails development environment with Vagrant
AWS Cloud9 environment construction Update Ruby to the latest stable version
[Ruby on Rails] Introduced paging function
Basic knowledge of Ruby on Rails
Progate Ruby on Rails5 Looking Back
[Unity] Android development environment construction procedure