Installing RetroPie on a Raspberry Pi 5 using the command line



The prompt
Write me to guide to installing RetroPie on a Raspberry Pi 5 using the command line in terminal.
The context is that there is currently no precompiled image of RetroPie that's available specificially for the Raspberry Pi 5.
My expecation is that you will tell me to install a headless version of Raspberry Pi OS and then input a sequence of instructions in the terminal. But if there's a simpler way I'm all ears.
The output
You're correct, as of right now there isn't a pre-built RetroPie image specifically for the Raspberry Pi 5. We'll have to do a manual installation on top of Raspberry Pi OS. Here's a comprehensive guide, emphasizing command-line operations.
Prerequisites & Preparation
1. Hardware
Raspberry Pi 5 (4GB or 8GB recommended)
MicroSD Card (16GB minimum, 32GB or larger recommended for more games) – and preferably a fast one (UHS-I or UHS-3).
Power Supply (USB-C, official Raspberry Pi 5 supply is highly recommended)
Micro-HDMI to HDMI cable (for initial setup)
USB Keyboard (for initial setup)
USB Gamepads (after setup) – you can configure them later.
(Optional) Ethernet cable or a working Wi-Fi connection.
(Optional, but recommended) A case with a heatsink and/or fan for the Pi 5. It can get hot!
2. Software
Raspberry Pi Imager (on your main computer) - Download from the official Raspberry Pi website: https://www.raspberrypi.com/software/
A way to connect to your Pi via SSH (like PuTTY on Windows, or the built-in terminal on macOS/Linux). We'll enable this during setup.
Install Raspberry Pi OS (Bookworm - 64-bit - Lite)
We're going to use the Lite version (headless) because we don't need a graphical desktop environment for RetroPie. This saves resources and provides a cleaner setup.
1. Use Raspberry Pi Imager
Open Raspberry Pi Imager.
CHOOSE DEVICE: Select "Raspberry Pi 5".
CHOOSE OS: Select "Raspberry Pi OS (other)" -> "Raspberry Pi OS Lite (64-bit)". Crucially, make sure it's the 64-bit version, based on Bookworm.
CHOOSE STORAGE: Select your microSD card. Double-check that you've selected the correct drive, as this will erase it!
Click the gear icon (Advanced Options): This is very important!
Set hostname: Choose a hostname (e.g.,
retropie
). This makes it easier to find on your network.Enable SSH: Check the box. Set a strong password for the
pi
user (or, better yet, set up public key authentication, but that's beyond the scope of this basic guide). Remember this password!Configure Wi-Fi (optional): If you'll be using Wi-Fi, enter your SSID and password here. If using Ethernet, you can skip this.
Set locale settings: Set your time zone and keyboard layout.
Click "WRITE": This will erase your microSD card and install Raspberry Pi OS Lite. It will take a few minutes.
2. First Boot (Headless - Optional, but recommended)
Insert the microSD card into your Raspberry Pi 5.
Connect the power supply.
The Pi will boot up. If you connected it to a monitor and keyboard, you can log in using the username
pi
and the password you set in the Imager. However, we'll be doing everything via SSH.
3. Connect via SSH
Find your Pi's IP address: You can usually find this in your router's admin interface (look for the hostname you set). Or, if you have a monitor connected temporarily, you can run
hostname -I
in the Pi's terminal to see its IP.Open your SSH client:
Windows (PuTTY): Enter the Pi's IP address in the "Host Name" field, make sure "Port" is 22, and select "SSH" as the connection type. Click "Open."
macOS/Linux (Terminal): Open a terminal window and type:
ssh pi@<your_pi_ip_address>
(replace<your_pi_ip_address>
with the actual IP).
Log in: You'll be prompted for the password you set for the
pi
user.
Update and Install RetroPie
Now that you're connected via SSH, we'll perform all the remaining steps via the command line.
1. Update System Packages
sudo apt update && sudo apt full-upgrade -y && sudo apt install git -y
This updates the package lists and upgrades all installed packages to their latest versions. The -y
flag automatically answers "yes" to any prompts. We also install git
, which we'll need later.
2. Download the RetroPie Setup Script
git clone --depth=1 https://github.com/RetroPie/RetroPie-Setup.git
This downloads the RetroPie-Setup script from the official GitHub repository. --depth=1 makes it a shallow clone, saving time and space.
3. Run the RetroPie Setup Script:
cd RetroPie-Setup
sudo ./retropie_setup.sh
This navigates to the downloaded directory and executes the setup script with root privileges.
4. RetroPie Setup Menu (Important Choices):
The script will open a text-based menu. You'll navigate using the arrow keys, Enter to select, and Tab to move between options.
Basic Install: Choose "Basic Install" and confirm. This will install the core RetroPie packages and emulators. This will take a significant amount of time (potentially hours), as it compiles everything from source.
Manage Packages: After the basic install is complete, you can install additional emulators, ports, and other features from the "Manage Packages" menu. Some recommendations, but explore and choose what you want:
Manage Core Packages: If you're feeling adventurous, check for any updates here after the initial install.
Manage Main Packages: Install any additional emulators you want that weren't included in the basic install.
Manage Optional Packages: Consider installing things like
lr-mame
(a more up-to-date MAME core),lr-fbneo
(for Neo Geo and other arcade games), and any other specific console emulators you're interested in.Manage Experimental Packages: Use these with caution, as they may be unstable.
Configuration / Tools:
audiosettings: Configure your audio output (HDMI or 3.5mm jack).
bluetooth: If you're using Bluetooth controllers, configure them here.
configedit: Allows editing of RetroPie/RetroArch configuration files (advanced users).
raspi-config: This launches the familiar Raspberry Pi configuration tool, where you can adjust things like overclocking (be careful!), boot options, and more.
retropie-config: RetroPie-specific configuration options.
runcommandconfig: Configure how the Runcommand (the program that launches emulators) behaves.
showip: Displays your Pi's IP address.
splashscreen: Choose or customize your splash screen.
Update: After installing additional packages, it's a good idea to run the "Update" option to ensure everything is up-to-date.
5. Configure Controllers:
After installation and reboot, RetroPie will usually prompt you to configure your controllers on first boot. Follow the on-screen instructions to map the buttons.
If it doesn't prompt you, or you need to reconfigure, you can do this from the RetroPie menu within EmulationStation (the frontend). Press
Start
to open the main menu, then navigate to "Configure Input".
6. Reboot
sudo reboot
This will reboot your Pi and start EmulationStation.
Wrapping up
This guide should get you up and running with RetroPie on your Raspberry Pi 5. Remember to consult the official RetroPie documentation (https://retropie.org.uk/docs/) for more detailed information and troubleshooting tips. Enjoy your retro gaming!