# Desktop app

> The Postern desktop app for macOS, Windows and Linux, building it from source, connecting to a Hub, menus, options, updates, the built-in Hub, data folder and logs.

Source: https://docs.posternmail.app/apps/desktop/

Postern for macOS, Windows and Linux is a real mail client: it gets your mail straight from
your providers, keeps a copy on the computer and keeps working when your Hub is down. This page
covers building it, connecting it, everything in its menus and options, and where it keeps its
files.

The app shows the same interface as the [web app](https://docs.posternmail.app/apps/web/) and adds what a desktop app needs:
native notifications, an unread badge, a tray or menu bar icon, a `mailto:` handler, downloads,
spell checking and an optional quick-compose shortcut that works from any app.

## Get the desktop app

No installers are published yet. Until the first release, build the app from source. The build
makes installers for the system you run it on.

### What you need

- **Git** and **Node.js 24** or newer, with **pnpm 11** (`corepack enable` installs the right
  pnpm version).
- **Go 1.27** or newer. The app's mail engine and its built-in Hub are the Hub program
  (`postern-hub`), compiled for your computer.
- **bash**. The build scripts are bash scripts. On Windows, run the commands in Git Bash.
- **Linux:** the `rpm` tool, if you want the `.rpm` package (`sudo apt install rpm` on Debian
  and Ubuntu).

### Build the desktop app

```sh
git clone https://github.com/TheOriUHD/postern.git
cd postern
corepack enable
pnpm install
scripts/build-hub.sh --web-only
pnpm --filter @postern/desktop bundle-hub
pnpm --filter @postern/desktop dist
```

What the steps do:

| Command | What it does |
|---|---|
| `scripts/build-hub.sh --web-only` | Builds the web app and puts it where the Hub embeds it. |
| `pnpm --filter @postern/desktop bundle-hub` | Compiles the Hub for this system into `apps/desktop/resources/hub/<os>-<arch>/`: macOS arm64 and x64, Windows x64, or Linux x64 and arm64. `-- --target linux/arm64` builds only the given targets; `-- --with-web` runs the web build first, so you can skip the previous step. |
| `pnpm --filter @postern/desktop dist` | Bundles the app and runs electron-builder. The installers land in `apps/desktop/release/`. `-- --dir` makes only an unpacked app, without installers. |

> [!IMPORTANT]
> Don't skip `bundle-hub`. Without it the app has no mail engine: it can then only show your
> Hub's web app (it says "This copy of Postern can't keep mail on this computer"), and it
> can't run a Hub for you.

> **Check:** `apps/desktop/release/` holds the installers listed below.

> **If it did not work:** `bundle-hub` fails with "missing scripts/build-hub.sh" when it doesn't
> run inside the repository, and with `go: command not found` when Go is missing. On Linux,
> a failing `.rpm` step usually means the `rpm` tool is missing.

### What `dist` produces

| System | Files in `apps/desktop/release/` |
|---|---|
| macOS | `Postern-<version>-arm64.dmg` and `Postern-<version>-x64.dmg`, plus a `.zip` of each (used by the updater) |
| Windows | `Postern-Setup-<version>.exe` (x64 installer) |
| Linux | `Postern-<version>-<arch>.AppImage` and `.deb` for x64 and arm64, `.rpm` for x64 |

The version is the one in `apps/desktop/package.json` (currently `0.1.0`).

### Unsigned builds

Your build is unsigned unless you set signing certificates (`CSC_LINK` and
`CSC_KEY_PASSWORD` for macOS, plus `APPLE_ID`, `APPLE_APP_SPECIFIC_PASSWORD` and
`APPLE_TEAM_ID` for notarization; `WIN_CSC_LINK` and `WIN_CSC_KEY_PASSWORD` for Windows). An
unsigned build works the same, with two differences:

- It doesn't update itself (see [Updates](https://docs.posternmail.app/apps/desktop/#updates)).
- The system warns before the first start when the installer came from somewhere else, for
  example when you copy it to another computer through a download or a chat app.

| System | What you see | What to do |
|---|---|---|
| macOS | "Postern" can't be opened because Apple cannot check it for malicious software (wording varies by macOS version). | Open **System Settings → Privacy & Security**, scroll down and click **Open Anyway** next to the message about Postern. Then open the app again. An app you built on the same Mac usually opens without this. |
| Windows | SmartScreen: "Windows protected your PC". | Click **More info**, then **Run anyway**. |
| Linux | Nothing. | Make the AppImage executable (`chmod +x Postern-*.AppImage`) or install the `.deb` or `.rpm`. |

### Install your build

| System | How |
|---|---|
| macOS | Open the `.dmg` for your Mac (`arm64` for Apple silicon, `x64` for Intel) and drag Postern to Applications. |
| Windows | Run `Postern-Setup-<version>.exe`. It installs for your user only, without asking for an administrator. |
| Debian, Ubuntu | `sudo apt install ./Postern-<version>-<arch>.deb` |
| Fedora | `sudo dnf install ./Postern-<version>-x64.rpm` |
| Any Linux | Run the AppImage. |

## Connect to your Hub

On the first start the app shows **Connect to your Hub**.

1. Type your Hub's address in **Hub address**, for example `https://mail.example.com` or
   `https://hub.tailnet-1234.ts.net`, and click **Connect**.
2. The app reads `/api/v1/info` from that address to check that a Hub answers.
3. A sign-in window opens with your Hub's own sign-in page. Sign in as usual (password, single
   sign-on, or a passkey where the window offers it), then click **Allow and open the app**.
   If you signed in a while ago, the Hub first asks for your password (or to sign in again)
   before it allows a new device.
4. The window closes by itself. The app gets your mailbox sign-ins from the Hub and starts
   downloading your mail. The first start takes a little while.

> **Check:** **Settings** shows "Your Hub:" with your Hub's address and **Connected** at the top.

> **If it did not work:** the connect screen says what went wrong (see the table below).
> **Details** under the message shows the technical reason.

On the connect screen:

- **Cancel** stops a sign-in that is in progress. **Show Sign-in Window** brings the sign-in
  window back if it got hidden behind another window. A sign-in that isn't finished within 15
  minutes is cancelled.
- **Don't keep mail on this computer** connects "through your Hub" instead: the app shows the
  Hub's web app and stores no mail on the computer. If you switch a Hub to this later, the app
  offers to delete the copy it kept before (**Remove Copy**).
- **Recent** lists the Hubs you used. Click one to connect again. The **×** next to an entry
  removes that Hub from this computer: after asking, it signs the computer out of that Hub and
  deletes the mail kept for it. Anything not yet sent from this computer, such as messages
  written while offline, is lost.
- **How to set up a Hub** opens the setup guide. Development builds also show a
  `http://localhost:8080` shortcut.

### How the app reads the address

- Without a scheme, the app adds `https://`, or `http://` for `localhost`, LAN addresses and
  single-word host names (a `.ts.net` name always gets `https://`).
- Only the scheme, host and port count. A path is dropped: a Hub always lives at the root of
  its address.
- Plain `http://` to anything other than this computer or a Tailscale address shows **This
  connection isn't encrypted**, because your password and mail would cross the network
  unprotected. **Connect anyway** continues.
- A Hub behind Cloudflare Access works: the sign-in window first shows Cloudflare's own page
  (an email code), then your Hub's. If the Hub has a service token set
  (`POSTERN_ACCESS_CLIENT_ID`, `POSTERN_ACCESS_CLIENT_SECRET`), the app receives it at sign-in
  and sends it with every request. See [Cloudflare](https://docs.posternmail.app/reach/cloudflare/).

### Messages on the connect screen

| Message | Meaning and what to do |
|---|---|
| Couldn't find *host* | The name doesn't resolve. Check the spelling, or connect Tailscale or your VPN. |
| Couldn't reach *host* | The Hub isn't running, the port is wrong, or the computer is on another network. A Hub uses port 8080 unless set up otherwise. |
| *host* didn't answer in time | The Hub is starting, or the network is slow. Try again in a moment. |
| You're offline | The computer has no network. |
| Your Hub's certificate isn't trusted | Self-signed, expired or for another name. The app never skips this check. Use a certificate from Let's Encrypt or Tailscale (see [HTTPS](https://docs.posternmail.app/reach/https/)), or add your own certificate authority to the computer's trusted certificates. |
| *host* isn't a Postern Hub | Something answered, but without the Hub's API (wrong port or path). |
| *host* asks for a password first | A web server in front of the Hub uses a browser password prompt (HTTP basic authentication). The app can't sign in to that. Protect the Hub with Tailscale, a VPN or Cloudflare Access instead. |
| *host* answered with an error | The Hub or a proxy in front of it answered with an HTTP error. **Details** shows the status code. |
| The port of *host* is blocked | Like browsers, the app refuses a few ports, such as 25, 110 or 6000. Run the Hub on another port. |
| Your Hub is newer than this app / Your Hub is too old for this app | The API versions differ. Update the older side. See [Version compatibility](https://docs.posternmail.app/apps/#version-compatibility). |
| This copy of Postern can't keep mail on this computer | The build has no mail engine. Tick **Don't keep mail on this computer**, or rebuild with `bundle-hub`. |

### Switch Hubs

**File → Use a Different Hub…** (on macOS in the **Postern** menu, and in the tray menu) opens
the connect screen. Choosing the Hub you are already on takes you back to it.

### Sign-in pages outside the app

Single sign-on runs inside the sign-in window: it may visit your identity provider over HTTPS
and then come back. Google's sign-in (when you add a Gmail mailbox) and Microsoft's device-code
page open in your browser instead.

## Starting, restarting and being offline

- **Starting.** The main window opens at once with the Postern logo while the app gets ready.
  Your mail then appears in the same window, on the page you were on when you quit, and other
  windows you had open come back too.
- **If it can't start,** the window says why, with **Try again**, **Open Log Folder** and **Use
  a Different Hub…**. Examples: "This computer's disk is full", "The mail kept on this computer
  is damaged", "Another copy of Postern may still be running on this computer", "Postern is
  taking too long to start" (not ready after 30 seconds).
- **If the app's background process stops while it runs,** Postern restarts it. Your windows
  stay as they are, including a message you are writing, and a "Postern is restarting…" strip
  shows until it is back. If it keeps stopping, the window says "Postern keeps stopping" and
  **Try again** starts it once more.
- **Hub unreachable, mail on this computer.** Mail keeps working. The settings header and the
  sidebar say **Hub offline**, with the number of changes waiting. See
  [Working offline](https://docs.posternmail.app/apps/offline/).
- **Hub unreachable, through your Hub.** The window shows an offline page. It retries by itself
  after 5, 10 and 20 seconds, then every 30 seconds, and at once when the network comes back.
  **Try again** retries now. A proxy answering 502, 503 or 504 counts as unreachable.

## Menus and shortcuts

`⌘` on macOS, `Ctrl` on Windows and Linux.

| Action | Menu | Shortcut |
|---|---|---|
| New message | File → New Message | `⌘N` |
| New window | File → New Window | `⇧⌘N` |
| Print | File → Print… | `⌘P` |
| Settings | Postern → Settings… (macOS), File → Settings | `⌘,` |
| Search mail | Edit → Find → Search Mail | `⌘F` |
| Find on the page | Edit → Find → Find on Page… | `⌥⌘F` on macOS, `F3` on Windows and Linux |
| Find next / previous | Edit → Find | `⌘G` / `⇧⌘G` |
| Command palette | View → Command Palette… | `⌘K` |
| Show or hide the sidebar | View → Show or Hide Sidebar | `⌘.` |
| Zoom in / out / actual size | View | `⌘+` or `⌘=` / `⌘-` / `⌘0` |
| Back / forward | Go | `⌘[` / `⌘]` on macOS, `Alt+←` / `Alt+→` on Windows and Linux |
| Inbox | Go → Inbox | `⌘1` |
| Next / previous conversation | Go | `⌥⌘↓` / `⌥⌘↑` on macOS; `J` / `K` everywhere |
| Reply / Reply All / Forward | Message | `⌘R` / `⇧⌘R` / `⇧⌘F` |

- `⌘R` replies, as in other mail apps. It never reloads the app.
- Reply, Reply All and Forward act on the open conversation.
- The web app's own keyboard shortcuts work too and win where they overlap. See
  [Keyboard shortcuts](https://docs.posternmail.app/using/shortcuts/).
- On Windows and Linux the menu bar appears when you press `Alt`.
- No shortcut on Windows or Linux uses `Ctrl+Alt`: on many keyboards that is how `AltGr` types
  characters such as `@`, `€` or `µ`.
- The zoom level is remembered.
- **Window → Main Window** brings the main window back after you closed it. On macOS the Dock
  menu has **New Message**, **New Window** and **Main Window**.
- **Help** has **Postern Documentation**, **Setting Up a Hub**, **Report an Issue** and **Open
  Log Folder** (on Windows and Linux also **Check for Updates…** and About).

### Quick compose from anywhere

A shortcut that opens a new message while you are in another app. It is off until you turn it
on, and you choose the key: open **Desktop App Options**, switch on **Start a new message from
any app** and click **Record Shortcut**. Postern suggests `⌃⌥⌘M` on macOS and `Alt+Shift+M`
on Windows and Linux. It refuses keys your system or your typing needs, such as `⌥⌘M` ("Minimize
All" on a Mac) or `Ctrl+Alt` with a letter on Windows. If another app already uses your choice,
the options window says so.

## Desktop App Options

Settings that belong to this computer rather than to your account. Open **Desktop App
Options…** from the **Postern** menu on macOS, the **File** menu on Windows and Linux, the tray
menu, or **Settings → Notifications** in the app.

| Section | Option | What it does |
|---|---|---|
| Quick compose from anywhere | Start a new message from any app, Shortcut | See [above](https://docs.posternmail.app/apps/desktop/#quick-compose-from-anywhere). |
| In the background | Show Postern in the menu bar (macOS) / Show Postern's icon near the clock | The tray or menu bar icon with the unread count and **New Message**. Some Linux desktops have no place for it. |
| | Keep running when the window is closed (Windows, Linux) | Closing the window leaves Postern in the tray, so new mail is still announced. Needs the tray icon. |
| | Open Postern when you log in | Installed copies on macOS and Windows. On Linux, add Postern to your desktop's startup apps yourself. |
| | Open it in the background (Windows) | Starts at login without showing a window. |
| Writing | Check spelling while typing | On a Mac it uses the languages from System Settings → Keyboard. On Windows and Linux, choose every language you write in. |
| Email links | Default mail app | Makes Postern open `mailto:` links. See [System integration](https://docs.posternmail.app/apps/desktop/#system-integration). |
| Mail on this computer | One row per Hub | The size of the mail kept for each Hub, "in use now" or "not in use", and **Remove…** for a copy that is not in use. |
| About | Version, updates, Logs | **Check for Updates…** and **Open Log Folder**. |

## System integration

- **Notifications.** One native notification per new mail whenever Postern is not the window
  you are working in, also when its window is visible behind another app. Clicking one brings
  Postern to the front and opens the conversation. **Settings → Notifications → Notifications
  on this computer** and **Sound** switch them for this computer.
- **Unread badge.** On the Dock icon (macOS), as an overlay on the taskbar button (Windows), and
  on the launcher icon where the Linux desktop supports it.
- **Tray or menu bar icon** with the unread count (beside the icon in the macOS menu bar, a dot
  on Windows and Linux). Its menu: **New Message**, **Show Postern**, **Desktop App Options…**,
  **Use a Different Hub…**, **Quit Postern**.
- **Closing the main window keeps Postern running,** so notifications keep arriving. On macOS
  it stays in the Dock. On Windows and Linux it stays in the tray and says so the first time.
  Without a tray icon (switched off, or a Linux desktop without one), closing the window
  quits.
- **Default mail app.** Choose **Default Mail App** in the menu (it has a check mark when
  Postern is the default), in Desktop App Options, or in **Settings → Notifications**. Then
  `mailto:` links open a new message in Postern.
  - macOS and Linux: it takes effect right away. If the system refuses, Postern says so and you
    set it in the system's own settings.
  - Windows: the system wants you to confirm it yourself. Postern opens **Settings → Default
    apps**; choose Postern for `MAILTO`.
  - A mail link clicked while you are not signed in brings Postern forward and opens the
    message as soon as you are connected.
- **Downloads.** Attachments are saved straight to your Downloads folder, never over an
  existing file (a second `report.pdf` becomes `report (2).pdf`). The Dock or taskbar icon
  shows the progress, and a notification shows the file in its folder when you click it. PDF
  attachments open in a preview inside the app.
- **Several windows.** **File → New Window** opens another window on the same page. Window
  sizes and positions are remembered, and open windows come back at the next start.
- **Links** in mail open in your default browser. Only `http`, `https` and `mailto` links are
  ever handed to the system, and only your Hub's pages load inside the app. Right-click an
  address for **New Message to …** or **Copy Email Address**.
- **Right-click** also offers **Copy Image** and **Save Image As…** on pictures, the usual text
  commands, **Spelling Languages** in text fields on Windows and Linux, and **Look Up** on a
  Mac.

## Updates

Signed release builds check for updates 15 seconds after the start and every 6 hours, and
download them in the background. When one is ready, a notification and the menu item
**Restart to Update to** *version* install it right away; otherwise it installs the next time
you quit. To turn the automatic check off, start the app with the environment variable
`POSTERN_DISABLE_UPDATES=1`.

These copies don't update themselves, and the About section of Desktop App Options says why:

| Copy | Says |
|---|---|
| Unsigned builds (every build from source without certificates) | This copy of Postern doesn't update itself. |
| `.deb` and `.rpm` packages | Updates come from your system's package manager. |
| Started with `POSTERN_DISABLE_UPDATES=1` | Automatic updates are switched off on this computer. |
| Development copies (`pnpm --filter @postern/desktop dev`) | This is a development copy. |

**Check for Updates…** (the **Postern** menu on macOS, **Help** on Windows and Linux, and
Desktop App Options) works in every copy: it asks the project's releases page for the newest
version and offers **Open Download Page**. Until the first release is published, it can only
answer "Couldn't check for updates".

To update a build from source, pull the repository, run the build again and install the new
installer over the old one. Your settings, sign-in and mail stay.

## No server? Run a Hub on this computer

Builds that include the bundled Hub (every build made with `bundle-hub`) show **No server?
Run a Hub on this computer** at the bottom of the connect screen. The app then starts a Hub in
the background and connects to it. On first use you run the Hub's setup in the app window,
like on a server.

- The Hub listens on `127.0.0.1` only, on a free port the app picks (and keeps across starts, so
  you stay signed in). The app opens it as `http://localhost:<port>`, where passkeys work.
  Other devices can't reach it.
- The app shows the Hub's web app, so this Hub keeps a full copy of your mail.
- It runs while the app runs and stops when you quit. Mail syncs, and scheduled sends, snoozes
  and rules run, only while Postern is open. The Hub also stops when the app is killed or
  crashes: the app holds a pipe to it, and the Hub runs with `POSTERN_EXIT_ON_STDIN_CLOSE=1`,
  which makes it stop when that pipe closes.
- If it stops unexpectedly, the app starts it again (after 1, 2, then 3 seconds) and your
  windows stay as they are, with "Your Hub on this computer is restarting…" on top. After three
  stops in a row the window says so, and **Try again** starts it once more.
- Its data and key live in the app's data folder: `hub-data/` and `hub-key/hub.key`. Its log is
  `logs/hub.log`.

This is a good way to try Postern or to use it on one computer. Phones can't connect to it.
When you want other devices, move to a server: [back up](https://docs.posternmail.app/admin/backups/) the data and key,
restore them on the server, and connect the app to the server's address.

### Run Hub commands against the built-in Hub

The app has no menu for Hub commands such as `doctor` or `backup`, but the bundled program is
the normal `postern-hub` and accepts every [command](https://docs.posternmail.app/reference/cli/). Point it at the
app's folders with `--data-dir` and `--key-file`. Quit Postern first for `restore` and
`rotate-key`.

On macOS:

```sh
APP="/Applications/Postern.app/Contents/Resources/hub/hub"
DATA="$HOME/Library/Application Support/Postern"
"$APP" doctor --data-dir "$DATA/hub-data" --key-file "$DATA/hub-key/hub.key"
"$APP" backup --data-dir "$DATA/hub-data" --key-file "$DATA/hub-key/hub.key" --out "$HOME/postern-backup"
```

The program sits in the app's `resources/hub/` folder (`hub.exe` on Windows). On Windows that
is usually `%LOCALAPPDATA%\Programs\Postern\resources\hub\hub.exe`, with the data in
`%APPDATA%\Postern`. From a `.deb` or `.rpm` it is usually
`/opt/Postern/resources/hub/hub`, with the data in `~/.config/Postern`. An AppImage keeps it
inside the image: run the AppImage with `--appimage-extract` to unpack it.

`doctor` warns that `POSTERN_PUBLIC_URL` is not set. That is expected for the built-in Hub.

## Data folder and logs

| System | Data folder |
|---|---|
| macOS | `~/Library/Application Support/Postern` |
| Windows | `%APPDATA%\Postern` |
| Linux | `~/.config/Postern` |

Copies installed before the rename to Postern keep using their old `MailClient` folder until a
`Postern` folder exists.

| Inside | What |
|---|---|
| `desktop.json` | The Hub address, recent Hubs, window positions and your Desktop App Options. |
| `hub-tokens.json` | This computer's sign-in to each Hub, encrypted with the system's key storage (Keychain, Windows data protection, or the Linux keyring). Without a Linux keyring the sign-in isn't saved, and you sign in again after each restart; the connect screen says so. |
| `engine/<host>-<hash>/` | The mail kept on this computer, one folder per Hub. Remove a copy in Desktop App Options or with the **×** on the connect screen, not by hand. |
| `hub-data/`, `hub-key/hub.key` | The built-in Hub's data and master key, if you use it. |
| `logs/desktop.log` | The app itself: windows, sign-in, updates. |
| `logs/mail.log` | Getting and sending the mail kept on this computer. |
| `logs/hub.log` | The built-in Hub, if you use it. |

**Help → Open Log Folder** opens `logs`, and so do the **Open Log Folder** buttons on screens
that report a problem and in Desktop App Options. Each log starts a new file once it reaches
10 MB, and one older file is kept. Postern removes sign-in secrets from `desktop.log` and
`mail.log` before a line is written.

## Signing out

Signing out (**Settings → Account → Sign out…**), or being signed out from **Settings → Devices** on another
device, ends this computer's session and deletes the mail kept on it for that Hub. The connect
screen then says "Signed out of …" or, if your Hub ended the session, "You were signed out of
…". If the app can't read its saved sign-in (for example after you chose **Deny** in a
Keychain prompt), it says "Your saved sign-in couldn't be read" and asks you to sign in again.

## Uninstalling

1. For each Hub, remove it with the **×** under **Recent** on the connect screen. This signs
   the computer out of the Hub and deletes the mail kept for it. Skipping this leaves the
   device in **Settings → Devices** on the Hub, where you can sign it out instead.
2. Remove the app:
   - macOS: drag Postern from Applications to the Trash.
   - Windows: **Settings → Apps → Installed apps → Postern → Uninstall**.
   - Linux: remove the package with your package manager, or delete the AppImage.
3. Uninstalling keeps the data folder. Delete it yourself (see
   [Data folder and logs](https://docs.posternmail.app/apps/desktop/#data-folder-and-logs)) to remove everything, including the built-in
   Hub's data and key. Back them up first if you still need that Hub.

## Developer tools

Development copies have **View → Toggle Developer Tools** and a reload item. In a packaged
build, start the app with `POSTERN_DEVTOOLS=1` to get the same items, for example on macOS:

```sh
POSTERN_DEVTOOLS=1 /Applications/Postern.app/Contents/MacOS/Postern
```

Working on the app itself is described in [Development](https://docs.posternmail.app/development/).
