Before you can build PX4 from source you need a working toolchain: a C++ cross-compiler for ARM targets, CMake, Python, and the Gazebo simulator libraries. The fastest path is Ubuntu 22.04 or 24.04 with the automated setup script. macOS and Windows via WSL2 are also supported, though with additional manual steps.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/PX4/PX4-Autopilot/llms.txt
Use this file to discover all available pages before exploring further.
- Ubuntu
- macOS
- Windows (WSL2)
Ubuntu 22.04 (Jammy) and 24.04 (Noble) are the primary supported platforms. PX4’s CI and release builds run on Ubuntu 24.04; Ubuntu 22.04 is also fully supported. Older Ubuntu versions are not supported.The If you want the script without cloning the full source tree first, you can download it directly:
ubuntu.sh script installs everything you need in one step: the GCC ARM cross-compiler, CMake, Ninja, Python packages, and Gazebo Harmonic.Clone the PX4 source repository
The setup script lives inside the repository, so clone it first. The
--recursive flag fetches all required submodules.Run the setup script
Navigate into the cloned directory and run Acknowledge any prompts as the script progresses. The script installs packages via
ubuntu.sh:apt and pip, so you need sudo access.Restart your computer
Some environment changes (group membership for serial ports, updated
PATH) only take effect after a full reboot.Docker alternative
If you do not want to modify your host system, you can build inside a pre-configured Docker container. From the root of thePX4-Autopilot directory:
docker_run.sh script pulls the official PX4 build container and runs the provided make command inside it. No toolchain installation is required on the host.
Docker builds require Docker Engine (or Docker Desktop on macOS/Windows) to be installed and running. The first run downloads a multi-gigabyte container image.
Next steps
With your environment set up, you are ready to compile firmware and run your first simulation.Build PX4 firmware
Compile for SITL and hardware targets, and flash firmware to a flight controller.
Developer overview
Understand the development workflow, key tools, and code structure before diving in.