Skip to main content
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:

Install Dependencies

Optional: Install 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:
For older versions, use the ubuntu-toolchain-r/test PPA.

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:
You may need additional packages to build QEMU:

CMake 3.25.0 or Later

The build scripts will automatically build CMake from source if your version is older than 3.25.x.
If you previously used an older CMake version, remove the cache files:

Build and Run

1

Clone the Repository

First, clone the SerenityOS repository:
2

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.
3

Log In to SerenityOS

When SerenityOS boots, log in with the default credentials:
  • Username: anon
  • Password: foo
By default, the anon user can become root without a password as a development convenience. To prevent this, remove anon from the wheel group.

Build Without Running

If you want to test whether your code changes compile without running the VM:

Additional Commands

The serenity.sh script provides many other commands. Run it without arguments to see the full list:

Troubleshooting

If the build breaks after pulling changes:
  1. Rebuild the toolchain if prompted
  2. Try with a clean repository if toolchain rebuild doesn’t help
  3. Ask for help in the #build-problems channel on Discord
If it builds on CI, it should build for you too.
If you see an error like fusermount: failed to open /etc/mtab: No such file or directory:
This creates the missing symlink that fuse2fs requires.
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):
1

Navigate to Port Directory

2

Run the Package Script

The source code will be downloaded and the package will be built.
3

Launch SerenityOS

The next time you start SerenityOS, the port will be available.

Port Dependencies

Some ports require additional dependencies on your host system. Common requirements include:
Special port dependencies:
  • 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