The first build will take some time as it downloads database files and builds the cross-compiler toolchain. Subsequent builds will be much faster.
Prerequisites
SerenityOS supports building on Linux, macOS, Windows (with WSL2), and many other *nix systems. Choose your platform below:- Ubuntu / Debian
- Arch Linux / Manjaro
- Windows (WSL2)
- macOS
Install Dependencies
fuse2fs for building images without root privileges.Install GCC 14 or Clang 17+
A host compiler that supports C++26 features is required. The newer the better.Option 1: GCC 14
GCC 14 is available in Ubuntu 24.04 (Noble) and later:Option 2: Clang 17+
Recent versions of Clang are available in the LLVM apt repositories:QEMU 6.2 or Later
QEMU 6.2 is available in Ubuntu 22.04. For earlier versions, build QEMU from the toolchain:CMake 3.25.0 or Later
The build scripts will automatically build CMake from source if your version is older than 3.25.x.
Build and Run
Build and Launch SerenityOS
Run the following command to build and run SerenityOS:This single command will:
- Download required database files (first time only)
- Build the SerenityOS cross-compiler toolchain (first time only)
- Compile all of SerenityOS
- Install built files into
Build/<architecture>/Root - Build a disk image
- Start SerenityOS using QEMU
The chosen architecture defaults to your host architecture. Supported architectures are x86_64, aarch64, and riscv64.
Build Without Running
If you want to test whether your code changes compile without running the VM:Additional Commands
Theserenity.sh script provides many other commands. Run it without arguments to see the full list:
Troubleshooting
Build is broken after git pull
Build is broken after git pull
If the build breaks after pulling changes:
- Rebuild the toolchain if prompted
- Try with a clean repository if toolchain rebuild doesn’t help
- Ask for help in the
#build-problemschannel on Discord
If it builds on CI, it should build for you too.
fusermount error during build
fusermount error during build
If you see an error like This creates the missing symlink that
fusermount: failed to open /etc/mtab: No such file or directory:fuse2fs requires.Toolchain is outdated
Toolchain is outdated
When updating to a newer compiler, you may need to rebuild the toolchain. See the troubleshooting guide for details.
Installing Ports
To add a package from the ports collection (for example,curl):
Port Dependencies
Some ports require additional dependencies on your host system. Common requirements include:file(version 5.44 exactly, for file)libpython3-dev(for boost)lua(for luarocks)openjdk-17-jdk(to compile OpenJDK)p7zip-full(for msttcorefonts)rake(to build mruby)
You may need a symlink from
/usr/bin/python to /usr/bin/python3 as some ports depend on python existing, most notably ninja.Next Steps
Advanced Build Instructions
Learn about advanced build options and customization
Contributing Guide
Start contributing to SerenityOS
FAQ
Find answers to common questions
Documentation
Browse technical documentation
