First steps with CS50 - How to install Love2D on Linux

3min read
Love2D Tutorial Linux

September 15, 2018

Alternative text for image

Harvard’s CS50 created the Introduction to videogame development course that I started following with the Italian community.

This course requires students to edit some pre-made game projects that were originally made with Love 0.10. Unfortunately they are not compatible with the newest Love2D version that you find in most Linux distros (v11.1 at the time of writing), but these simple guide will help you fixing this issue.

UPDATE: a new version of the push library has been released in 2020 🎉 Check it out, it should be compatible with the latest Love2D versions.

Problem: CS50 games won’t run on recent Love2D versions

If you run the first assignment with Love v11.1, you will probably get this error:


push.lua:101: attempt to call field 'getPixelScale' (a nil value)


push.lua:101: in function 'initValues'
push.lua:48: in function 'setupScreen'
main.lua:93: in function 'load'
[C]: in function 'xpcall'
[C]: in function 'xpcall'

We will get rid of this!

Solution: install an older Love2D version on Ubuntu

The solution is to install an older version, but this is not trivial on Linux systems so here it is how to do it on Ubuntu and Manjaro (my main operating systems).

Luckily Love2D has a a list of older Ubuntu packages hosted on bitbucket and that is what I used to download a Love2D Debian package .deb and install it on Ubuntu 18.04:

# uninstall Love2D (this is needed only if you already installed it)
sudo apt purge love

# download Love2D 0.10.2 and the liblove dependency (links are for x64 architecture)

# install Love2D 0.10.2
sudo apt install libphysfs1  # required dependency
sudo dpkg -i love_0.10.2ppa1_amd64.deb
sudo dpkg -i liblove0_0.10.2ppa1_amd64.deb

Now you should be able to type love in the terminal and see the correct welcome screen.
To start your game just specify the path to the game folder, in example love assignment-0.

Love2D 0.11 welcome screen

Solution: compile & install an older Love2D version on Arch Linux

If you use Arch Linux (or Manjaro, Antergos and similar derivatives) you won’t find prebuilt Love2D packages on their website. So we have to download the source code and compile it by ourselves.

# download love 0.10.2 source code
# decompress and extract the archive 
tar xzf 0.10.2.tar.gz
# enter the project directory
cd rude-love-afc69c4f7145

# Install the build dependencies. For me only this one was required:
sudo pacman -S physfs
# but feel free to install al the ones listed in here
# in the official Love2D build instructions:

# build the binary

# install 
sudo make install

In case you want to remove this package, go into the build directory and then:

# if you want to remove the packages
sudo make uninstall

Succesful Love2D compilation and installation

On a final note it’s probably better to create a package and then install it with pacman. Actually I never used the ABS (Arch Build System) so maybe now I have a good excuse to use it.

Hope this will help some new GNU/Linux user, I guess not everyone is a pro and sometimes a little guide like this one can be helpful.

Ciao guys!

comments powered by Disqus