If you decide to build MAME from source code in Linux, you should probably directly use the git repository on Github since bugs are corrected very quickly (and new ones are as quickly introduced ...).

As Raspberry Pi OS is just a Debian Linux, you will find instructions for both platforms on this single page.

Required libraries

The following descriptions apply to MAME release 0.256 and higher.

You need

  • gcc / gcc-c++ version 10 or higher
  • git
  • make
  • Development package of alsa
  • Development package of gconf2
  • Development package of gtk2
  • Development package of the SDL2 library
  • Development package of the SDL2_ttf library
  • Development package of the Qt5Core library
  • Development package of Pulseaudio (since 0.230)


Ubuntu users need to make use of the apt(-get) command or check the software repository tools.

For Ubuntu 22.04 and newer, the following packages are required:

sudo apt install git
sudo apt install make
sudo apt install g++
sudo apt install qtbase5-dev
sudo apt install libsdl2-ttf-dev
sudo apt install libfontconfig-dev

or with a single line:

sudo apt install git make g++ qtbase5-dev libsdl2-ttf-dev libfontconfig-dev


(July 2023)

For an openSUSE installation, either use YaST or (if not already installed) follow this path:

sudo zypper install git-core
sudo zypper install make
sudo zypper install gcc-c++
sudo zypper install libSDL2_ttf-devel
sudo zypper install alsa-devel
sudo zypper install fontconfig-devel
sudo zypper install libqt5-qtbase-devel
sudo zypper install libXi-devel
sudo zypper install libpulse-devel
sudo zypper install libXinerama-devel

or with a single line:

sudo zypper install git-core make gcc-c++ libSDL2_ttf-devel alsa-devel fontconfig-devel libqt5-qtbase-devel libXi-devel libpulse-devel libXinerama-devel

Raspberry Pi OS

Debian version 11 (bullseye)

Building on the older Raspbian OS is not possible after release 0.254.

The following description refers to the Raspberry Pi OS with desktop installation. You need to use the apt(-get) command or check the software repository tools.

git, make, g++ are already available.

The following packages are required:

sudo apt install qtbase5-dev
sudo apt install libsdl2-ttf-dev
sudo apt install libfontconfig-dev

or with a single line:

sudo apt install qtbase5-dev libsdl2-ttf-dev libfontconfig-dev

Getting the sources

Use git to clone the repository to your local drive:

git clone https://github.com/mamedev/mame.git

This will create a mame directory containing a ready-to-use makefile.

When you want to get a current version, use the git pull command.

git pull

If you want to build a specific release or based on a particular commit, use git checkout.

git checkout b41370db026

This will set your repository to the state when the 0.256 release was published. Alternatively, you can use the tag mame0256:

git checkout mame0256


A makefile is included with the MAME distribution so you can easily start the build process with make.

Cleaning the build environment is optional, but if you experience problems when compiling, try to clean first.

make clean

If you only want the TI systems to be included, you may specify them in the command line:

make -j4 SOURCES=src/mame/drivers/ti99_4x.cpp,src/mame/drivers/ti99_4p.cpp,src/mame/drivers/ti99_8.cpp,src/mame/drivers/geneve.cpp,src/mame/drivers/ti99_2.cpp REGENIE=1 TOOLS=1

REGENIE should be specified, since the GENie project generator tool is used for building. TOOLS will generate the additional helpers imgtool, chdman, and others. You probably don't need them if you use TIImageTool.

The -j4 switch is used to start 4 build jobs concurrently, which speeds up the compilation considerably. You must make sure that your build environment is not too old. GCC should be at least version 10. You can also use clang by


(possibly with version number, like clang-13, clang++-13)

After compiling has finished, you should have a freshly built mame executable file.

Special comments for Raspberry Pi

Although the Raspberry Pi 4 is the most powerful Raspberry computer, it will run into heavy thrashing during the build process, which means it seems to make no more progress after some time. Do not stop the it. It may take some hours until the process is complete, but it will eventually reach its goal.

One particular slow point during compilation occurs when compiling the files src/emu/emumem_*.

One thing you can do is to tell your Raspberry to avoid swapping as long as possible. The parameter for this is called swappiness, and it is set to 60 by default. Maybe try 25 or lower. You can make this change permanent. Add the following line to the /etc/sysctl.conf file:


Many sources recommend not to increase the swap space on the Raspberry Pi, as this swap space is located on the SD card, and this will lower the lifetime of the flash memory on the card. However, I noticed that during building, all of the 4 GiB of main memory was used up, and the small swap space (100 MiB) was also gone, and from here, the system dropped into thrashing hell. So I increased the swap size to 1 GiB, and the atop tool showed me that the build process drew another 600 MiB from the swap file. But then, it continued.

Also, while you should make use of the -j parameter for Linux on PCs, you may get better results on a Raspberry Pi with fewer processes. If your Raspberry Pi gets stuck in thrashing, try building with a single job (just leave away the -j option). Also, once the emumem files have been built, you may interrupt the process and restart it with more parallel processes.

We use cookies
We use cookies on our website. All of these cookies are essential for the operation of the site. They are only used on this site and not transmitted to any third party. None of them are Tracking Cookies, and they do not serve to analyze your behavior.