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:
~/.rbenv
:
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
rbenv install
command:
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
~/.bashrc
or ~/.bash_profile
:
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
source ~/.bashrc # or `~/.bash_profile`
Install packages to prepare your build environment.
rbenv install 3.0.1
rbenv global 3.0.1
$
symbol represents the prompt):
$ rbenv versions
system
* 3.0.1 (set by /home/<me>/.rbenv/version)
$ ruby -e "puts 'Hello Ruby'"
Hello Ruby
Raylib Ruby 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
openSUSE
sudo zypper install libSDL2-devel libSDL2_image-devel libSDL2_mixer-devel libSDL2_ttf-devel
Arch
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 »