Skip to content

Instantly share code, notes, and snippets.

@leo-aa88
Created August 30, 2026 08:03
Show Gist options
  • Select an option

  • Save leo-aa88/adfe188d4c9a5853855add23c5eb33d7 to your computer and use it in GitHub Desktop.

Select an option

Save leo-aa88/adfe188d4c9a5853855add23c5eb33d7 to your computer and use it in GitHub Desktop.
Install raylib 6.0 on Linux from the official prebuilt tarball

Install raylib 6.0 on Linux from the official prebuilt tarball

These steps install the official prebuilt raylib-6.0_linux_amd64.tar.gz release under /usr/local.

The prebuilt archive contains the raylib headers and libraries, but does not include a raylib.pc file for pkg-config, so we create one manually.

1. Extract raylib

cd ~/Downloads

tar -xzf raylib-6.0_linux_amd64.tar.gz
cd raylib-6.0_linux_amd64

Optional: inspect the archive:

ls

You should have at least:

include/
lib/

2. Install the headers

Copy the raylib headers to /usr/local/include:

sudo cp -r include/* /usr/local/include/

Verify:

ls /usr/local/include/raylib.h

3. Install the libraries

Copy the prebuilt raylib libraries to /usr/local/lib:

sudo cp -a lib/libraylib* /usr/local/lib/

Refresh the dynamic linker cache:

sudo ldconfig

Verify that the files were installed:

ls /usr/local/lib/*raylib*

Check that the dynamic linker can find raylib:

ldconfig -p | grep raylib

You should see entries pointing to /usr/local/lib, such as:

libraylib.so.600
libraylib.so

4. Check for pkg-config metadata

The raylib 6.0 prebuilt Linux archive does not include raylib.pc.

You can confirm with:

find . -name 'raylib.pc'

Or inspect all relevant raylib files:

find . -name 'raylib.pc' -o -name 'libraylib*' -o -name 'raylib.h'

The archive should contain something similar to:

./include/raylib.h
./lib/libraylib.a
./lib/libraylib.so.600
./lib/libraylib.so.6.0.0
./lib/libraylib.so

5. Create raylib.pc

Create the system-local pkg-config directory:

sudo mkdir -p /usr/local/lib/pkgconfig

Create /usr/local/lib/pkgconfig/raylib.pc:

sudo tee /usr/local/lib/pkgconfig/raylib.pc >/dev/null <<'EOF'
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: raylib
Description: A simple and easy-to-use library to enjoy videogames programming
Version: 6.0
Libs: -L${libdir} -lraylib
Libs.private: -lm -lpthread -ldl -lrt -lX11
Cflags: -I${includedir}
EOF

6. Verify pkg-config

Check that pkg-config can now find raylib:

pkg-config --modversion raylib

Expected output:

6.0

Check the compiler and linker flags:

pkg-config --cflags --libs raylib

Expected output should look similar to:

-I/usr/local/include -L/usr/local/lib -lraylib

Complete installation script

The whole installation can also be reduced to:

#!/usr/bin/env bash

set -e

RAYLIB_VERSION="6.0"
ARCHIVE="raylib-${RAYLIB_VERSION}_linux_amd64.tar.gz"
DIR="raylib-${RAYLIB_VERSION}_linux_amd64"

cd ~/Downloads

tar -xzf "$ARCHIVE"
cd "$DIR"

sudo cp -r include/* /usr/local/include/
sudo cp -a lib/libraylib* /usr/local/lib/

sudo ldconfig

sudo mkdir -p /usr/local/lib/pkgconfig

sudo tee /usr/local/lib/pkgconfig/raylib.pc >/dev/null <<'EOF'
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: raylib
Description: A simple and easy-to-use library to enjoy videogames programming
Version: 6.0
Libs: -L${libdir} -lraylib
Libs.private: -lm -lpthread -ldl -lrt -lX11
Cflags: -I${includedir}
EOF

echo
echo "raylib installed successfully."
echo

echo "Installed version:"
pkg-config --modversion raylib

echo
echo "Compiler/linker flags:"
pkg-config --cflags --libs raylib

echo
echo "Dynamic linker entries:"
ldconfig -p | grep raylib

Save that as, for example:

install-raylib-6.0.sh

Then make it executable and run it:

chmod +x install-raylib-6.0.sh
./install-raylib-6.0.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment