Build OBS Studio from Source on Linux

This guide provides a step-by-step walkthrough on how to compile and build OBS Studio from source on a Linux operating system. It covers installing the necessary system dependencies, cloning the official repository, configuring the build environment with CMake, and compiling the software for your system.

Step 1: Install Dependencies

Before compiling OBS Studio, you must install the required build tools, libraries, and development headers. On Debian and Ubuntu-based distributions (such as Linux Mint and Pop!_OS), run the following command in your terminal:

sudo apt update && sudo apt install -y \
  build-essential \
  cmake \
  git \
  pkg-config \
  libx11-dev \
  libgl1-mesa-dev \
  libpulse-dev \
  libasound2-dev \
  libudev-dev \
  libv4l-dev \
  libva-dev \
  liblzma-dev \
  libcurl4-openssl-dev \
  libssl-dev \
  libmbedtls-dev \
  libqt6svg6-dev \
  qt6-base-dev \
  qt6-wayland-dev \
  libwayland-dev \
  libx11-xcb-dev \
  libxcb-xinput-dev \
  libxcb-ximage-dev \
  libxcb-shm0-dev \
  libxcb-xfixes0-dev \
  libxcb-randr0-dev \
  libfontconfig1-dev \
  libfreetype6-dev \
  swig \
  python3-dev \
  libfftw3-dev \
  libspeexdsp-dev \
  libwayland-egl1-mesa \
  libegl1-mesa-dev \
  libpci-dev \
  libpipewire-0.3-dev \
  libdrm-dev

Note: For Fedora, Arch Linux, or other distributions, install the equivalent development packages for Qt6, Wayland, X11, FFmpeg, and PulseAudio/ALSA.

Step 2: Clone the Repository

Clone the official OBS Studio GitHub repository. Use the --recursive flag to ensure all required submodules are downloaded automatically.

git clone --recursive https://github.com/obsproject/obs-studio.git
cd obs-studio

Step 3: Create the Build Directory

It is best practice to perform an out-of-source build by creating a dedicated directory for compilation.

mkdir build && cd build

Step 4: Configure the Build with CMake

Configure the build system using CMake. You can define the installation path using the CMAKE_INSTALL_PREFIX variable. To install OBS Studio system-wide, use /usr or /usr/local.

cmake -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_WAYLAND=ON ..

If you prefer to build a portable version that runs solely from the build folder without installing it to your system directories, use:

cmake -DLINUX_PORTABLE=ON ..

Step 5: Compile the Source Code

Compile the software using the make command. Utilize all available CPU cores to speed up the compilation process by appending -j$(nproc).

make -j$(nproc)

Step 6: Install OBS Studio

Once the compilation is complete, install the binaries to your system. If you configured CMake with a system-wide directory in Step 4, run:

sudo make install

If you configured a portable build, you do not need to run the install command; you can run the executable directly from the bin/64bit/ directory inside your build folder:

./bin/64bit/obs