Ruby
Install and manage Ruby locally (Windows, macOS, Linux) using installers or version managers; use Bundler for dependencies.
🧾 Overview
Ruby is used for bots, APIs (Sinatra), and full frameworks (Rails). Local installation lets you manage gems and test before deploying.
📥 Installation (choose one)
Download the latest Ruby+Devkit (x64) from https://rubyinstaller.org/downloads/
Run installer (enable MSYS2 when prompted).
Let post-install script finish (toolchain setup).
Verify & install bundler
ruby -v
gem -v
gem install bundler
bundler -vInitialize project (optional)
bundle init
bundle installsudo apt update
sudo apt install -y ruby-full build-essential
ruby -v
gem -v
gem install bundlersudo dnf install -y ruby ruby-devel @development-tools
ruby -v
gem -v
gem install bundlersudo pacman -S --needed ruby base-devel
ruby -v
gem -v
gem install bundlerDependencies (Debian example):
sudo apt update
sudo apt install -y build-essential libssl-dev libreadline-dev zlib1g-dev \
libyaml-dev libffi-dev libgdbm-dev libncurses5-dev libsqlite3-devInstall rbenv + ruby-build:
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
rbenv install 3.3.0
rbenv global 3.3.0
ruby -v
gem install bundlerbrew update
brew install ruby
echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
ruby -v
gem -v
gem install bundlerbrew install rbenv
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
source ~/.zshrc
rbenv install 3.3.0
rbenv global 3.3.0
ruby -v
gem install bundler✅ Verification
ruby -v
gem -v
bundler -vAll commands should output versions.
💎 Managing Gems
Initialize
bundle initAdd to Gemfile
gem "httparty"Install / update
bundle install
bundle update httpartyRun script with locked environment
bundle exec ruby app.rb🔄 Updating
Ruby (rbenv)
rbenv install <version> && rbenv global <version>
All gems
bundle update
One gem
bundle update <name>
Bundler
gem install bundler
🗃 Common Commands
gem list
gem install <name>
gem uninstall <name>
bundle init
bundle install
bundle update
bundle exec ruby main.rbLast updated