Skip to main content

Build from Source

Clone the repository and build Daintree from source.

Updated
Reviewed

Prerequisites

Building Daintree needs four things:

  • Git v2.30+
  • Node.js v22.12.0+: the exact version is pinned in .node-version and .nvmrc. Use nvm or fnm to match it.
  • npm: ships with Node.js.
  • Platform build tools: needed to compile the native node-pty module (see below).

Install the Xcode Command Line Tools if you don't have them:

xcode-select --install

Clone & Install

git clone https://github.com/daintreehq/daintree.git
cd daintree
npm install

The postinstall script rebuilds the native modules (node-pty and better-sqlite3) against the Electron runtime. If it fails, run npm run rebuild yourself.

Development

Start the dev server with hot reload:

npm run dev

This runs the Vite renderer dev server and the Electron main process together. Renderer changes hot-reload right away. Main-process changes trigger an automatic restart.

Production Build

Build the app without packaging it:

npm run build

This compiles the renderer with Vite into dist/ and the main process with ESBuild into dist-electron/.

Run the Built App

Once it's built, you can launch Daintree directly. No installer needed:

npx electron .

This reads the "main" field in package.json to find the compiled entry point at dist-electron/electron/main.js. It's the quickest way to test a production build locally.

Tip
electron is already a devDependency, so npx uses the locally installed copy. Nothing extra to download.

Package for Distribution

Build platform-specific installers:

npm run package:mac

Writes a DMG and ZIP to the release/ directory. The binary is universal, so it runs on Intel and Apple Silicon.

npm run package does the same thing and picks the target for your current platform.

Tip
Local builds skip code signing and notarization. The binaries run fine for personal use, but the OS may warn you on first launch.

Troubleshooting

node-pty build failures

If npm install fails on the native module rebuild:

  1. Check that the platform build tools are installed (see Prerequisites above).
  2. Rebuild by hand: npm run rebuild
  3. On macOS, confirm the Xcode CLI tools are current: xcode-select --install

Wrong Node.js version

Daintree needs Node.js 22.12.0+. If you see a version error, switch to it:

nvm install    # reads .nvmrc automatically
nvm use