Repository navigation
Getting Started on Raspbian (Raspberry Pi)
Note: This guide only applies to the original Raspberry Pi and the Raspbian Linux distribution. If you use a Raspberry Pi 2 or 3, please enable OpenGL and then follow the ‘normal’ instructions for Ubuntu/Debian here: Getting Started on Linux. Please also install Gosu using sudo gem install gosu --pre for now; the current stable version will not work.
In theory, Raspbian is 'just' another Linux distribution. However, its package manager is missing Gosu's (new) main dependency, SDL 2. There is a package called libsdl2-dev in the Debian Jessie repositories, but it comes without the RPI video driver and cannot be used to install Gosu.
You can follow these steps to install Ruby/Gosu anyway:
-
Install Raspbian on an SD card, if you haven't already (downloads and instructions)
-
In Raspbian, go to the SDL 2 download page and download the latest version in
.tar.gzformat. If you click "Save", it will be downloaded into/home/pi, which is what I will assume in the steps below. -
Also download the latest version of SDL_ttf into the same directory.
-
Open a terminal and run:
sudo apt-get install ruby ruby-dev build-essential libfreeimage-dev libopenal-dev libpango1.0-dev libsndfile-dev libudev-dev libasound2-dev
-
Unpack and compile SDL 2. This will take roughly one hour to complete:
tar zxvf SDL2-2.*.tar.gz cd SDL2-2.* ./configure --prefix=/opt/SDL2 --disable-video-x11 make sudo make install
If you are already using Raspbian Jessie, try this variant of the
./configurecommand instead:./configure --host=armv7l-raspberry-linux-gnueabihf --disable-pulseaudio --disable-esd --disable-video-mir --disable-video-wayland --disable-video-x11 --disable-video-opengl
-
Unpack and compile SDL_ttf. This shouldn't take nearly as long.
cd tar zxvf SDL2_ttf-2.*.tar.gz cd SDL2_ttf-2.* ./configure --prefix=/opt/SDL2 && make && sudo make install
-
Install Gosu with the following command:
sudo gem install gosu -- --with-cflags=-I/opt/SDL2/include/SDL2 --with-cppflags=-I/opt/SDL2/include/SDL2 --with-ldflags=\"/opt/SDL2/lib/libSDL2.a /opt/SDL2/lib/libSDL2_ttf.a\"
-
Optional: Run the example games to verify that everything works.
sudo gem install gosu-examples gosu-examples --fullscreen
-
Optional: Clean up by deleting the SDL folders and
.tar.gzfiles in your home directory.
Congratulations, you should now be able to run Ruby/Gosu games!
Note: One unresolved issue in Raspbian is that games started from a terminal will leak keystrokes into the terminal, and you might accidentally trigger commands while playing games (#213). You can use this handy tool to prevent this from happening.
Note: It is best to run all games in fullscreen mode on Raspbian, since windowed mode does not work as expected.
- Getting Started
- Tutorials
- In-Depth Documentation
- Deployment
-
Gosu Boards
- Gosu Exchange - Questions? Ask them here.
- Gosu Showcase - Show off your projects.
- Extending Gosu - Libraries that play nicely with Gosu.