[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 ①
Ruby on Rails development environment construction on M1 Mac
[Environment construction] Ruby on Rails 5.2 system development environment construction [within 1 hour]
Docker the development environment of Ruby on Rails project
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
Ruby on Rails for beginners! !! Summary of new posting functions
[Environment construction] Get the Ruby on Rails 6 development environment within 1 hour
Explanation of Ruby on rails for beginners ③ ~ Creating a database ~
[Ruby on Rails] About bundler (for beginners)
[Docker] Development environment construction Rails6 / Ruby2.7 / MySQL8
Muscle Ruby on Rails Day 1 ~ Environment Construction ~
Ruby on Rails development environment construction with Docker + VSCode (Remote Container)
Explanation of Ruby on rails for beginners ⑤ ~ Edit and delete database ~
Create a development environment for Ruby 3.0.0 and Rails 6.1.0 on Ubuntu 20.04.1 LTS
[Personal memo] Ruby on Rails environment construction (Windows)
[Rails] Procedure for linking databases with Ruby On Rails
How to build a Ruby on Rails environment using Docker (for Docker beginners)
Environment construction of Ruby on Rails from 0 [Cloud9] (From Ruby version change to Rails installation)
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)
Ruby on Rails environment construction using VirtualBox, Vagrant, cyberduck
Procedure for introducing Docker into the development environment of existing Rails applications [Rails, MySQL, Docker]
From 0 to Ruby on Rails environment construction [macOS] (From Homebrew installation to Rails installation)
Definitely useful! Debug code for development in Ruby on Rails
Environment construction for Servlet application development
Environment construction with Docker for beginners
Basic knowledge of Ruby on Rails
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]
Ruby on Rails for beginners! !! Post list / detailed display function summary
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
CentOS8 + Anaconda + Django development environment construction procedure
[Processing x Java] Construction of development environment
Java development environment construction memo on Mac
Let's summarize "MVC" of Ruby on Rails
part of the syntax of ruby ​​on rails
[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
[For beginners] Build the environment for Ruby on Rails Tutorial 4th Edition (Rails 5.1) in less than an hour!
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)