Learn how to set up your environment and install dependencies
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.1
$ rbenv global 2.6.1
$ rbenv versions system * 2.6.1 (set by /home/<me>/.rbenv/version) $ ruby -e "puts 'Hello Ruby'" Hello Ruby
You can also install SDL packages manually and install Simple 2D from source by doing the following:
$ sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev
# Or `dnf install` on 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
$ make && sudo make install
You’re now ready to install the gem!
$ gem install ruby2d
That’s it! Head back to the “get started” guide and write your first 2D app »