Play around with irb
irb
Create Workspace/scratch folder
Workspace/scratch
Setup and configure your code editor (vscode)
Write and run a ruby program on your machine
open your terminal
Ruby comes preinstalled on macOS
ruby --version or ruby -v to check version
ruby --version
ruby -v
This is your system ruby. You'll need to install different versions when developing rails applications. We'll get into this later.
Make sure you are using the correct version in Ruby Docs
type in irb
play around with ruby
type exit to exit irb shell
exit
scratch/
Enter open . in terminal window to open Finder
open .
Create Workspace/scratch/ folder
Workspace/scratch/
We can keep experimental ruby scripts in scratch/
vscode is a code editor that works well with ruby, rails, and pretty much any language
Open vscode
File -> Open Folder... -> (click Workspace/scratch/ folder)
Create hello.rb file in scratch/
hello.rb
Open hello.rb in vscode
create program that asks for name and says hello
print 'What is your name? ' name = gets.chomp puts "Hello #{name}"
Enter ruby hello.rb in the terminal
ruby hello.rb
Click File, Download Workspace
File
Download Workspace
install vscode Ruby Extension HTML CSS Support Extension GitLens Extension
Ruby Docs
Commands Cheatsheet
Install xcode command line tools xcode-select --install
xcode-select --install
Install multiple Ruby versions with rbenv
command + space (open spotlight search)
search 'terminal', press `enter`
root path ~
we should be in vscode scratch folder