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
Rails engineer environment construction ruby2.7.1
Ruby on Rails 6.0 environment construction memo
Rails Docker environment construction
[Docker] Development environment construction Rails6 / Ruby2.7 / MySQL8
Muscle Ruby on Rails Day 1 ~ Environment Construction ~
CentOS8.2 (x86_64) + ruby2.5 + Rails5.2 + MariaDB (10.3.17) environment construction
[Personal memo] Ruby on Rails environment construction (Windows)
Ruby on Rails development environment construction on M1 Mac
Rails6 development environment construction [Mac]
[Docker] Rails 5.2 environment construction with docker
Offline environment construction Ruby edition
[Super easy] Ruby environment construction
[Rails / MySQL] Mac environment construction
[Environment construction] Ruby on Rails 5.2 system development environment construction [within 1 hour]
Deploy to Ruby on Rails Elastic beanstalk (Environment construction)
[Environment construction Mac] Ruby on Rails (+ Webpacker handles errors)
Ruby on Rails environment construction using VirtualBox, Vagrant, cyberduck
Ruby environment construction summary ~ mac version ~
Rails on Docker environment construction procedure
[Environment construction with Docker] Rails 6 & MySQL 8
Troublesome Rails environment construction flow [Windows 10]
[Environment construction] Uninstall rails from local
[Rails] AWS EC2 instance environment construction
From 0 to Ruby on Rails environment construction [macOS] (From Homebrew installation to Rails installation)
[Procedure 1 for beginners] Ruby on Rails: Construction of development environment
[Environment construction] Get the Ruby on Rails 6 development environment within 1 hour
Ruby on Rails --From environment construction to simple application development on WSL2
Rails environment construction with Docker (personal apocalypse)
Ruby on Rails development environment construction with Docker + VSCode (Remote Container)
[Java] Environment construction
Rails API server environment construction using docker-compose
Java environment construction
[Spring] Environment construction
Rails & React & Webpacker & MySQL Environment Construction Manual
Docker environment construction
Environment construction of Ruby on Rails from 0 [Cloud9] (From Ruby version change to Rails installation)
[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)
Rails6 [API mode] + MySQL5.7 environment construction with Docker
[Ruby on Rails] Let's build an environment on mac
Penronse environment construction [Windows]
[Environment construction] Eclipse installation
[Flutter] Ubuntu 20.04 environment construction
Chapter 4 Rails Flavored Ruby
Ruby on Rails Elementary
Ruby on Rails basics
Circle CI environment construction
java development environment construction
Ruby On Rails Association
Ruby, Rails finally installed
virtulbox + vagrant + Docker + nginx + puma + MySQL Rails environment construction
Docker the development environment of Ruby on Rails project
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
[Spring Boot] Environment construction (macOS)
Ruby on rails learning record -2020.10.03
Difficulties in building a Ruby on Rails environment (Windows 10) (SQLite3)
I tried node-jt400 (Environment construction)