[Procedure 1 for beginners] Ruby on Rails: Construction of development environment

I started learning Ruby on Rails (hereinafter, rails) from the middle of May, and experienced everything from creating a super-standard chat application to deploying it, so I would like to organize the procedure as my own memorandum.

The flow of chat application creation with Rails that I did is as follows. Create the tutorial in 7 parts.

1 Build a development environment on Mac (Mac OS Catalina) 2 Create an app template with Rails 3 Front screen implementation (haml and sass) 4 Login function implementation 5 Group function implementation 6 Message function implementation 7 Implementation of Ajax asynchronous communication

Building a Ruby on Rails development environment

First, we will organize the environment construction procedure on Mac (Mac OS Catalina).

◉ Introduction of Command Line Tools

Command Line Tools = Tools for running software on the command line (terminal). To make the login shell zsh, execute the following command in the turnal.

#Set zsh as default
% chsh -s /bin/zsh
#Show login shell
% echo $SHELL
#If the following is displayed, it is successful.

Install Command Line Tools.

% xcode-select --install

◉ Introduction of Homebrew

Homebrew = Software management tool. Homebrew installation procedure.

#Move to home directory
% cd
#Check if you are in your home directory
% pwd
#Introduction of Homebrew(Processing takes time)
% ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
#Version confirmation
% brew -v
Homebrew "version"
#Keep up to date
% brew update
#Change permissions
% sudo chown -R `whoami`:admin /usr/local/bin

◉ Introducing the latest Ruby

#rbenv and ruby-install build
% brew install rbenv ruby-build
#Make it available from anywhere
% echo 'eval "$(rbenv init -)"' >> ~/.zshrc
#Reflect the modification of the configuration file
% source ~/.zshrc
#Introducing readline(For Japanese input)
% brew install readline
#Make it available from anywhere
% brew link readline --force

Install Ruby. (This will take some time)

% RUBY_CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline)"
% rbenv install "version"

This is the procedure after installation.

#Change from default ruby by specifying version
% rbenv global 2.6.5
#Reflect the change of settings
% rbenv rehash
#Check version
% ruby -v

◉ Introduction of MySQL

MySQL = database management tool

#MySQL installation
% brew install [email protected]
#Auto start setting
% mkdir ~/Library/LaunchAgents 
% ln -sfv /usr/local/opt/mysql\@5.6/*.plist ~/Library/LaunchAgents
% launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql\@5.6.plist 
#MySQL command introduction
% echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
% source ~/.zshrc
#Try the MySQL command
% which mysql
#Success if the following is displayed
/usr/local/opt/[email protected]/bin/mysql

Confirmation of MySQL startup.

#Check the status of MySQL
% mysql.server status
#Success if the following is displayed
 SUCCESS! MySQL running

◉ Introducing Rails

Rails (application framework) is a Ruby gem, so install it with bundler.

#Install bundler
% gem install bundler
#Rails installation(take time)
% gem install rails --version='6.0.0'
#Reload rbenv
% rbenv rehash
#Rails version check
% rails -v
Rails "version" 
(You will specify it later with the rails new command)

◉ Introduction of Node.js

It is a program that enables server-side processing with JavaScript. JavaScript is used when performing asynchronous communication with Rails. Install with Homebrew. (Ignore the already installed error)

# node.install js
% brew install nodejs
#Version confirmation
% node -v

◉ Introduction of yarn

JavaScript package manager. It runs on Node.js and manages the JavaScript library.

I have npm in the same JavaScript package manager, but yarn seems to be positioned as an improvement of npm.

#install yarn
% brew install yarn
#Check yarn version
% yarn -v

This completes the development environment construction for Ruby on Rails.

Recommended Posts

[Procedure 1 for beginners] Ruby on Rails: Construction of development environment
Explanation of Ruby on rails for beginners ①
Explanation of Ruby on rails for beginners ⑥ ~ Creation of validation ~
Explanation of Ruby on rails for beginners ② ~ Creating links ~
Explanation of Ruby on rails for beginners ⑦ ~ Flash implementation ~
Ruby on Rails 6.0 environment construction memo
Rails on Docker environment construction procedure
Explanation of Ruby on rails for beginners ③ ~ Creating a database ~
[Docker] Development environment construction Rails6 / Ruby2.7 / MySQL8
Muscle Ruby on Rails Day 1 ~ Environment Construction ~
Ruby on Rails --From environment construction to simple application development on WSL2
Ruby on Rails development environment construction with Docker + VSCode (Remote Container)
Explanation of Ruby on rails for beginners ⑤ ~ Edit and delete database ~
[Personal memo] Ruby on Rails environment construction (Windows)
[Rails] Procedure for linking databases with Ruby On Rails
How to solve the local environment construction of Ruby on Rails (MAC)!
Rails6 development environment construction [Mac]
Rails engineer environment construction ruby2.7.1
Rails environment construction Rails5.2.1 ruby2.5.1 Catalina
Build a Ruby on Rails development environment on AWS Cloud9
Stable development environment construction manual for "Rails6" with "Docker-compose"
Deploy to Ruby on Rails Elastic beanstalk (Environment construction)
[Environment construction Mac] Ruby on Rails (+ Webpacker handles errors)
Procedure for introducing Docker into the development environment of existing Rails applications [Rails, MySQL, Docker]
Environment construction for Servlet application development
Environment construction with Docker for beginners
Basic knowledge of Ruby on Rails
[Unity] Android development environment construction procedure
Explanation of Ruby on rails for beginners ④ ~ Naming convention and how to use form_Tag ~
Procedure for building a Rails application development environment with Docker [Rails, MySQL, Docker]
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
[Ruby on Rails] Introduction of initial data
[Rails] Addition of Ruby On Rails comment function
[Processing x Java] Construction of development environment
Java development environment construction memo on Mac
[Ruby] Building a Ruby development environment on Ubuntu
Rails [For beginners] Implementation of comment function
[Ruby on Rails] Japanese notation of errors
[Ruby on rails] Implementation of like function
Beginners create portfolio in Ruby on Rails
CentOS8.2 (x86_64) + ruby2.5 + Rails5.2 + MariaDB (10.3.17) environment construction
Build debug environment on container --Build local development environment for Rails tutorial with Docker-
How to build a Ruby on Rails development environment with Docker (Rails 6.x)
[Error] Switch environment construction to use Ruby on Rails oss (open source)
How to build a Ruby on Rails development environment with Docker (Rails 5.x)
Build a development environment for Docker + Rails6 + Postgresql
Validation settings for Ruby on Rails login function
Implementation of Ruby on Rails login function (Session)
[Beginner Procedure Manual 2] Ruby on Rails: Rails template creation
[Ruby on Rails] Until the introduction of RSpec
Environment construction procedure for using PowerMock with JUnit
Recommendation of Service class in Ruby on Rails
[Ruby on Rails] Select2 introduction memo for Webpacker
Ruby on Rails ~ Basics of MVC and Router ~
[Ruby on Rails] A memorandum of layout templates
[For beginners] Procedure for creating a controller using rails
Wordpress local environment construction & development procedure with Docker
WebSphere Liberty for Windows development environment maintenance procedure
[Ruby on Rails] Individual display of error messages