1. Open your first window
Choose the computer you’ll build on. Your choice applies throughout these six lessons.
Build a Session counter in six lessons: open a window, handle a button click, update a count, arrange controls, add navigation, and finish and test the app. Choose your development computer above; keep that choice as you work through the lessons.
You need basic Rust knowledge, a terminal, and a text editor. A target combines an operating system with a UI toolkit. This tutorial uses AppKit on macOS, WinUI on Windows, and GTK on Linux. A Day Piece describes part of the interface; the toolkit creates its native controls.
1. Prepare your computer
Install Git and current stable Rust through rustup, then prepare your platform’s tools:
macOS
Use an Apple silicon Mac with full Xcode 27 or newer. Open Xcode once to finish installation. In Terminal, use Bash or Zsh.
Windows
Use Windows with Visual Studio C++ Build Tools, the Windows SDK, the MSVC Rust toolchain, and Windows App Runtime 2.5.1 or newer. Use PowerShell 7 in a Developer PowerShell terminal so the C++ tools are on PATH.
Linux
These instructions use Ubuntu 24.04 or newer with GTK 4.10+, libadwaita 1.5+, librsvg 2.52+, their development packages, and pkg-config. Use Bash in a desktop session.
See system requirements for installation details. On macOS, select full Xcode as the active developer directory before continuing. On Windows, use the MSVC Rust toolchain. These are prerequisites; installing Day does not install the SDKs.
2. Install Day
macOS
cargo install day-cli --locked
Windows
cargo install day-cli --locked
Linux
cargo install day-cli --locked
This installs the latest published CLI from crates.io into Cargo’s executable directory.
The first installation compiles the CLI and downloads dependencies. Open a new terminal if
day is not found, or follow PATH troubleshooting.
You do not need mobile SDKs or a developer signing account for this desktop debug app.
Check the installation and the selected toolkit’s tools:
macOS
day --version
day doctor --toolkit appkit
Windows
day --version
day doctor --toolkit winui
Linux
day --version
day doctor --toolkit gtk
3. Create the project
Choose a directory where you keep your projects. Use an unused name if first-app already exists.
macOS
mkdir -p first-app/src first-app/resource/locales/en
cd first-app
Windows
New-Item -ItemType Directory -Path first-app/src, first-app/resource/locales/en
Set-Location first-app
Linux
mkdir -p first-app/src first-app/resource/locales/en
cd first-app
Create each file below. All file paths in this and subsequent lessons are relative to this app directory. This small project is written out to teach each part; the CLI’s general-purpose scaffold has a larger starter app.
Write Cargo.toml:
[package]
name = "first-app"
version = "0.1.0"
edition = "2024"
[workspace]
[lib]
name = "dayapp"
The empty [workspace] makes this project independent of any enclosing Cargo workspace.
[lib] name = "dayapp" gives the shared library the name used by main.rs and generated native
hosts. Create the source files before adding dependencies.
macOS
Write Day.toml:
schema = 1
[app]
id = "dev.daybrite.tutorial.session-counter"
title = "Session counter"
build = 1
targets = ["macos-appkit"]
[window]
width = 640
height = 480
min_width = 400
min_height = 320
Windows
Write Day.toml:
schema = 1
[app]
id = "dev.daybrite.tutorial.session-counter"
title = "Session counter"
build = 1
targets = ["windows-winui"]
[window]
width = 640
height = 480
min_width = 400
min_height = 320
Linux
Write Day.toml:
schema = 1
[app]
id = "dev.daybrite.tutorial.session-counter"
title = "Session counter"
build = 1
targets = ["linux-gtk"]
[window]
width = 640
height = 480
min_width = 400
min_height = 320
The app ID identifies this app. Use your own unique ID for a product. The dimensions are initial and minimum window sizes in points, chosen for this desktop exercise. The manifest title is packaging metadata; the window’s visible title comes from the catalog below.
Write build.rs:
fn main() {
day_build::prebuild_project().expect("day-build: prebuild");
}
Write resource/locales/en/app.ftl:
app_title = Session counter
welcome = Count the sessions you finish today.
Fluent catalogs hold user-facing text. The build script generates typed accessors from these message keys, so you can translate the interface without changing the Rust code.
Write src/lib.rs:
use day::prelude::*;
day::resources!();
day::day_start!(options: res::window_options(), root);
pub fn root() -> impl Piece {
label(res::str::welcome())
.padding(Space::L)
.id(id!(welcome_label))
}
Write src/main.rs:
fn main() {
day::launch(dayapp::res::window_options(), dayapp::root);
}
day::resources!() exposes the generated res module. res::window_options() installs the
catalog and supplies the localized window title and manifest geometry. root() describes the
window’s content. Space::L is a framework spacing token. The day_start! macro provides the
entry point used by generated native hosts; main.rs supplies a Rust desktop entry point.
The symbolic welcome_label ID lets UI tests find this label even after its text is translated.
Now add Day from crates.io:
macOS
cargo add 'day-app@0.*' --rename day
cargo add --build 'day-build@0.*'
Windows
cargo add 'day-app@0.*' --rename day
cargo add --build 'day-build@0.*'
Linux
cargo add 'day-app@0.*' --rename day
cargo add --build 'day-build@0.*'
cargo add takes the newest release and records it in Cargo.toml, and Cargo records the exact
versions in Cargo.lock; keep that lockfile with your app. The umbrella crate’s package is
day-app, and its library is day, so --rename day keeps the key day and the code says
use day::prelude::*. day-build is a build dependency, for build.rs.
Then give the app its toolkit features:
Append to Cargo.toml:
[features]
default = ["mock"]
mock = ["day/mock"]
appkit = ["day/appkit"]
gtk = ["day/gtk"]
winui = ["day/winui"]
The default mock feature supports editor checks; day build selects the feature for the
requested toolkit instead.
4. Prepare the native host
On macOS, create the Swift runner and native host configuration:
macOS
day project add-target macos-appkit
Keep those starter files under platform/macos/. The build generates the Xcode project.
Windows and Linux use the Rust desktop entry point above and do not need this command.
5. Build and open the window
From first-app, run:
macOS
day build -t macos-appkit
Windows
day build -t windows-winui
Linux
day build -t linux-gtk
macOS
day launch -t macos-appkit
Windows
day launch -t windows-winui
Linux
day launch -t linux-gtk
The build must exit successfully. The launch opens a window titled Session counter with the text Count the sessions you finish today. A debug build can append build information to the title.
macOS
Quit with Command-Q before continuing.
Windows
Close the app window before continuing.
Linux
Close the app window before continuing.
day launch builds again, so later
lessons need only that command after an edit. A note about a missing icon master is expected:
this app has no custom launcher icon.
Troubleshooting
| Symptom | Check and recovery |
|---|---|
day: command not found | Check that Cargo’s executable directory (~/.cargo/bin by default) is on PATH, then open a new terminal. |
| Doctor rejects Xcode | Select full Xcode 27 or newer with DEVELOPER_DIR, then run day doctor --toolkit appkit. Command Line Tools alone cannot build the host project. |
Cargo cannot find day | Check the day-app and day-build dependencies and that your connection can reach crates.io. |
A generated res::str name is missing | Check the catalog file path and exact key spelling, then rebuild. Do not write generated Rust files by hand. |
| The launch cannot find a project | Run it from the directory containing this app’s Day.toml. |
Editor support
The VS Code extension provides Day project and target commands in your editor. For AI-assisted work, start with the agent guide. Explore the Gallery for examples of larger apps.
Next step
Continue to 2. Handle a button click.