Windows and WSL

Episode #451 by Teacher's Avatar David Kimura

Summary

In this episode, we'll look at setting up a fresh Windows 11 environment for Ruby on Rails development. We'll be looking at a few different tricks that makes managing a Windows environment much easier.
rails windows wsl development 16:05

Chapters

  • Introduction (0:00)
  • Installing Windows Terminal (0:57)
  • Install WSL Debian (1:13)
  • Updating WSL Packages (2:41)
  • Installing initial packages (3:02)
  • Installing Oh My ZSH (3:26)
  • Install ASDF (3:49)
  • Installing Ruby (5:39)
  • Side Note About Developing on Windows (6:39)
  • Ruby Install Continued (8:13)
  • Installing Node and Yarn (9:10)
  • Setting new Rails App defaults (9:45)
  • Windows Package Manager (10:49)
  • Installing Visual Studio Code (12:42)
  • WSL Extension (13:23)
  • Installing PG or MySQL2 gems (14:46)
  • Final Thoughts (15:26)

Resources

This episode is sponsored by Honeybadger

Summary

# Windows Terminal
wsl --list --online
wsl --install -d debian
debian

# Debian Terminal
sudo apt update && sudo apt upgrade -y

# Install Oh-My-ZSH
sudo apt install curl git zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# Install ASDF
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0

source ~/.zshrc

# ~/.zshrc
source ~/.devrc

# ~/.devrc
. "$HOME/.asdf/asdf.sh"
export RUBY_YJIT_ENABLE=1

# Installing Ruby

asdf plugin add ruby

sudo apt-get install autoconf patch build-essential rustc libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libgmp-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev uuid-dev -y

asdf install ruby 3.3.0
asdf global ruby 3.3.0

gem update --system
echo 'gem: --no-document' >> ~/.gemrc
gem install rails

# Installing Node
asdf plugin add nodejs
asdf install nodejs latest
asdf global nodejs latest
npm -g install yarn

# Creating a Rails app
echo '--javascript esbuild' >> ~/.railsrc
echo '--css bootstrap' >> ~/.railsrc
echo '-a propshaft' >> ~/.railsrc
rails new example

# Installing Apps
winget search -q "Visual Studio Code"
winget install Microsoft.VisualStudioCode
winget search -q "Google Chrome"
winget install Google.Chrome

# Installing other dependencies
sudo apt install libpq-dev libmariadb-dev -y