Learn how to set up your Ruby environment on Linux
Installing Ruby with package managers (e.g. apt, yum, pacman) can cause issues. We recommend using a Ruby version manager instead, like rbenv. Here’s how to set it up:
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
export PATH="$HOME/.rbenv/bin:$PATH" eval "$(rbenv init -)"
source ~/.bashrc # or `~/.bash_profile`
Install packages to prepare your build environment.
rbenv install 2.6.2 rbenv global 2.6.2
$symbol represents the prompt):
$ rbenv versions system * 2.6.2 (set by /home/<me>/.rbenv/version) $ ruby -e "puts 'Hello Ruby'" Hello Ruby
Ruby 2D needs a few packages to tap into low-level graphics and hardware. Install the following for your Linux distribution.
Ubuntu, Debian, and Mint
sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev
CentOS and Fedora
sudo yum install SDL2-devel SDL2_image-devel SDL2_mixer-devel SDL2_ttf-devel
sudo zypper install libSDL2-devel libSDL2_image-devel libSDL2_mixer-devel libSDL2_ttf-devel
sudo pacman -S sdl2 sdl2_image sdl2_mixer sdl2_ttf
That’s it! Head back to the “get started” guide and write your first 2D app »