How to Compile Audacity from Source on Linux

Compiling Audacity from source code on Linux enables you to run the latest development features, optimize performance for your specific hardware, or test custom modifications. This guide outlines the essential prerequisites, required system dependencies, and step-by-step instructions to clone the official Audacity repository, configure the build environment with CMake, and compile the audio editor from scratch.

1. Install Required Build Tools and Dependencies

Audacity is written in C++ and requires modern build utilities, including CMake, a C++17-compliant compiler, Python, and development libraries for audio and GUI management.

On Ubuntu / Debian:

sudo apt update
sudo apt install -y git cmake build-essential python3 python3-pip \
    libgtk-3-dev libasound2-dev libjack-jackd2-dev libpulse-dev \
    libavformat-dev libsndfile1-dev

On Fedora:

sudo dnf install -y git cmake gcc-c++ python3 python3-pip \
    gtk3-devel alsa-lib-devel jack-audio-connection-kit-devel pulseaudio-libs-devel \
    ffmpeg-devel libsndfile-devel

On Arch Linux:

sudo pacman -S --needed git cmake base-devel python python-pip \
    gtk3 alsa-lib jack2 libpulse ffmpeg libsndfile

2. Clone the Audacity Repository

Clone the source repository from GitHub. Ensure you use the --recurse-submodules flag to download all nested libraries bundled with the project.

git clone --recurse-submodules https://github.com/audacity/audacity.git
cd audacity

If you prefer to compile a specific stable release rather than the development branch, list the tags and check out the desired version:

git tag -l
git checkout tags/Audacity-3.x.x -b my-build
git submodule update --init --recursive

3. Create a Build Directory

Always perform an "out-of-source" build to keep generated artifacts separated from the source files.

mkdir build
cd build

4. Configure the Project with CMake

Generate the build system files using CMake. Audacity relies on Conan or system packages to manage dependencies. By default, setting the build type to Release optimizes the application for standard use.

cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..

Note: If you encounter dependency issues, you can explicitly configure dependency handling by appending -Daudacity_has_vst3=OFF or specifying package managers according to Audacity's latest CMake options.

5. Compile Audacity

Execute the build using all available CPU cores to speed up compilation time:

cmake --build . --parallel $(nproc)

Depending on your hardware, the build process may take several minutes to complete.

6. Run or Install the Application

Once compilation finishes, you can run Audacity directly from the build directory without installing it to your system:

./bin/Release/audacity

To install the compiled binary, desktop entry, and icons globally on your system:

sudo cmake --install .

After installation, update the desktop database to make Audacity visible in your application launcher:

sudo update-desktop-database