This guide walks you through installing the latest development version of Mesa (similar to mesa-git on Arch Linux) on Fedora, while keeping the system-provided Mesa version intact.
This approach helps avoid breaking dependencies or rendering your system unusable due to driver conflicts.
Who is this guide for? This guide is written for all experience levels, including beginners. Each step includes explanations of what and why, so you can learn as you go.
Unlike some guides that replace system libraries, this one installs Mesa to an isolated location (/opt/mesa-git).
Why use
/opt?/optis a standard directory on Linux for optional or third-party software that isn't managed by your system's package manager. By installing Mesa here, you keep your system's original Mesa untouched and safe. This makes it easy to test, update, or remove your custom Mesa without risking your system's stability.
This means:
- You retain your working Fedora Mesa packages.
- You can test and use the bleeding-edge version without risking system stability.
- You can at any time pull the latest changes and repeat these steps to update to the latest version available.
Before you start, you need to install all the tools and libraries required to build Mesa from source.
sudo dnf builddep mesaThis will prompt you to install a large number of development packages. Review them carefully before confirming. These are needed so that Mesa can be compiled from its source code.
Mesa's source code is hosted on GitLab. You'll need to download ("clone") it to your computer.
cd ~/dev/ # or any other folder you prefer
git clone https://gitlab.freedesktop.org/mesa/mesa.git
cd mesaBy default, this checks out the latest development version.
If you prefer a specific version:
git checkout mesa-25.1.0To browse available versions, visit the Mesa tags page.
We'll build Mesa using a custom prefix to avoid overwriting system libraries.
What does "prefix" mean? The prefix is the directory where the compiled software will be installed. By setting it to
/opt/mesa-git, you make sure your custom Mesa doesn't interfere with the system version.
meson setup build/ \
-Dprefix=/opt/mesa-git \
-Dplatforms=x11,wayland \
-Dvulkan-drivers=amdNote: Replace
amdwith the Vulkan driver that matches your GPU. Valid options includeintel,nouveau,swrast,auto, orall.
| Flag | Description |
|---|---|
-Dprefix |
Specifies the installation directory (in our case /opt/mesa-git). |
-Dplatforms |
Build support for, amongst other backends, X11 and Wayland. |
-Dvulkan-drivers |
Vulkan drivers to include (e.g. intel, amd, etc.) |
You can then compile Mesa:
meson compile -C build/Install the compiled Mesa build:
sudo meson install -C build/This requires
sudobecause we're installing into/opt, which is a system directory only writable by administrators.
After installation, Mesa will reside in /opt/mesa-git.
To use your custom Mesa build, you must configure the system to prioritize the new libraries.
What is
/etc/environment?/etc/environmentis a system-wide configuration file that sets environment variables for all users and programs. By editing this file, you tell your system to use your custom Mesa libraries and drivers by default.
Edit /etc/environment:
sudo nano /etc/environmentAdd or update the following lines:
LD_LIBRARY_PATH="/opt/mesa-git/lib64:$LD_LIBRARY_PATH"
OCL_ICD_VENDORS="/opt/mesa-git/etc/OpenCL/vendors"
VK_DRIVER_FILES="/opt/mesa-git/share/vulkan/icd.d/radeon_icd.x86_64.json"What do these variables do?
LD_LIBRARY_PATHtells the system where to look for shared libraries (like Mesa's).OCL_ICD_VENDORStells OpenCL programs where to find vendor-specific drivers.VK_DRIVER_FILEStells Vulkan programs which driver files to use.Replace
radeon_icd.x86_64.jsonwith the appropriate file for your hardware. To find it, run:ls /opt/mesa-git/share/vulkan/icd.d/
If you want to test your Mesa build before applying it system-wide, you can temporarily set the environment variables in your current terminal session:
export LD_LIBRARY_PATH="/opt/mesa-git/lib64:$LD_LIBRARY_PATH"
export OCL_ICD_VENDORS="/opt/mesa-git/etc/OpenCL/vendors"
export VK_DRIVER_FILES="/opt/mesa-git/share/vulkan/icd.d/radeon_icd.x86_64.json"Tip: These
exportcommands only affect the current terminal window. Once you close it, your system will go back to using the default Mesa.
Then check if Mesa is being used:
vulkaninfo | grep "Vulkan Instance Version"Example output:
WARNING: radv is not a conformant Vulkan implementation, testing use only.
Vulkan Instance Version: 1.4.309
Check OpenGL version:
glxinfo | grep "OpenGL version"Example output:
OpenGL version string: 4.6 (Compatibility Profile) Mesa 25.2.0-devel (git-4339cf0aff)
If both commands return output from your custom Mesa build, you're all set! Feel free to now reboot and repeat the steps in this section to see if they were applied correctly by /etc/environment.
You've now installed and configured a bleeding-edge version of Mesa on Fedora without overwriting your system libraries. This setup is ideal for testing, development, or gaming with the latest Mesa features while preserving system stability.
- This will work fine for applications that are ran natively. For sandboxed applications like Snaps and Flatpaks this might cause problems if they need hardware acceleration. Since I don't use flatpaks or Snaps I will not be trying to figure out how to overcome the issues. If you know how to fix it feel free to reach out.
Great guide, worked perfectly for me on Fedora 41 using an AMD GPU. I really like the approach you took.
One thing I will point out though is that the path that was provided for the VK_DRIVER_FILES var was incorrect for me.
Yours:
/opt/mesa-git/share/vulkan/icd/radeon_icd.x86_64.jsonMine:
/opt/mesa-git/share/vulkan/icd.d/radeon_icd.x86_64.jsonThe icd directory is named icd.d when I compiled and installed Mesa from source.