Prerequisites
Project Configuration
After opening theserenity repository in CLion as a new project, the “Open Project Wizard” window will open.
CMake will complain with any build type other than
Default. Make sure CMAKE_BUILD_TYPE is empty in the Build/x86_64/CMakeCache.txt file.CMake Settings
Configure the following fields in the Open Project Wizard: Build type:Default
CMake Options:
Build/x86_64
If you already have the project open, access these settings via:
File → Settings → Build, Execution, Deployment → CMake
Excluding Build Artifacts
Source files are copied to theBuild directory during compilation. Exclude them from CLion indexing to avoid confusion and prevent accidental edits to copied files.
Exclude Build Directory
- Navigate to the
Projecttool window - Right-click the
Buildfolder - Select
Mark Directory as → Excluded
Include Headers for Code Insight
Mark source directories to enable proper code comprehension:- Right-click on each of these folders:
AK,Kernel,Userland - Select
Mark Directory as → Project Sources and Headers
Code Generation Settings
Import the SerenityOS code style to match the project’s coding standards:- Go to
Settings → Editor → Code Style → C/C++ - Click
Scheme → Cog icon → Import Scheme... - Import
CLionCodeStyleSettings.xmlfrom the Documentation directory
Quick Switching Between Kernel and Userland
CLion needs to know whether you’re working on Kernel or Userland code to correctly parse conditional compilation blocks:Remove Auto-Generated Targets
- Click the configuration dropdown (top right)
- Select
Edit Configurations - Press
Ctrl+Ato select all auto-generated targets - Press
Deleteto remove them


Add Kernel Configuration
- Press the
+button - Select
CMake Application - Name:
Kernel - Target:
Kernel(type to search)
Kernel | Default / Userland | Default button.
WSL-Specific Configuration
Toolchain Setup
If the serenity directory is on the WSL filesystem:- Go to
File → Settings → Build, Execution, Deployment → Toolchains - Click the
+icon - Select
WSL - In
Toolset, select your WSL distribution
Terminal Configuration
You can set the embedded terminal to use your WSL distribution’s shell:This is only useful if you don’t use an X-window server for QEMU. You can install QEMU natively on Windows and allow WSL to use it. See BuildInstructionsWindows.md for details.
Locate the Terminal Emulator
- Open CMD with elevated privileges
- Navigate to
C:/Program Files/WindowsApps/ - Run
dirand look for your distribution (e.g.,CanonicalGroupLimited.Ubuntu20.04onWindows_...) - cd into that directory
- Copy the absolute path to the shell executable (e.g.,
ubuntu2004.exe)
Configure CLion Terminal
- Go to
File → Settings → Tools → Terminal - Paste the path to
Shell path - Click OK
./Meta/serenity.sh commands directly from CLion’s terminal.
