CLI
Complete reference for the lightshell command-line interface.
The lightshell CLI creates, develops, builds, and diagnoses LightShell applications. Install it with go install github.com/lightshell-dev/lightshell@latest or download a prebuilt binary from the releases page.
Commands
Section titled “Commands”lightshell init
Section titled “lightshell init”Create a new LightShell project with a starter template.
Usage:
lightshell init <project-name>What it does:
- Creates a new directory with the given name
- Generates
lightshell.jsonwith sensible defaults - Creates a starter
index.htmlwith a basic UI and the LightShell client library included - Creates a minimal CSS file
Example:
lightshell init my-appcd my-applightshell devOutput structure:
my-app/ lightshell.json index.html style.csslightshell dev
Section titled “lightshell dev”Start the development server. Opens a window running your app with hot reload, DevTools enabled, and a relaxed Content Security Policy.
Usage:
lightshell devBehavior:
- Watches the project directory for file changes
- Automatically reloads the webview when HTML, CSS, or JS files change
- DevTools are enabled (right-click to inspect)
- Uses the relaxed dev CSP (
default-src 'self' 'unsafe-inline' 'unsafe-eval' lightshell: http://localhost:*) - Console output from
console.log()is printed to the terminal
Example:
cd my-applightshell devlightshell build
Section titled “lightshell build”Build a distributable application package. The output format depends on the current platform and the --target flag.
Usage:
lightshell build [flags]Flags:
| Flag | Description |
|---|---|
--target <format> | Output format (see table below). Default: app on macOS, appimage on Linux |
--sign | Code sign the build (macOS only, requires build.mac.identity in config) |
--notarize | Notarize the build with Apple (macOS only, requires --sign) |
--devtools | Include DevTools in the production build |
Target formats:
| Target | Platform | Output | Description |
|---|---|---|---|
app | macOS | .app bundle | Default macOS format, a standard application bundle |
dmg | macOS | .dmg disk image | DMG with drag-to-Applications installer layout |
appimage | Linux | .AppImage | Default Linux format, single portable executable |
deb | Linux | .deb package | Debian/Ubuntu package for apt install |
rpm | Linux | .rpm package | Fedora/RHEL package for dnf install |
all | both | all formats | Build all formats available for the current OS |
Examples:
# Default build — .app on macOS, AppImage on Linuxlightshell build
# macOS DMG with code signinglightshell build --target dmg --sign
# macOS DMG with signing and notarizationlightshell build --target dmg --sign --notarize
# Debian packagelightshell build --target deb
# RPM packagelightshell build --target rpm
# All formats for the current platformlightshell build --target all
# Production build with DevTools for debugginglightshell build --devtoolsOutput:
Build artifacts are placed in the dist/ directory:
dist/ MyApp.app/ # macOS .app bundle MyApp-1.0.0.dmg # macOS DMG MyApp-1.0.0-arm64.AppImage # Linux AppImage myapp_1.0.0_amd64.deb # Debian package myapp-1.0.0-1.x86_64.rpm # RPM packageBuild sizes:
- The hello-world example produces a binary under 5MB
- Final binary size depends on embedded HTML/CSS/JS assets
lightshell doctor
Section titled “lightshell doctor”Check the development environment for required dependencies and common issues.
Usage:
lightshell doctorWhat it checks:
- Go version (1.21+ required)
- CGO availability (
CGO_ENABLED=1) - Xcode Command Line Tools (macOS)
- WebKitGTK development headers (Linux:
libwebkit2gtk-4.1-dev) - GTK3 development headers (Linux:
libgtk-3-dev) - Code signing identity (if configured)
- Project structure validity
Example output:
LightShell Doctor=================
[ok] Go 1.22.0[ok] CGO enabled[ok] Xcode Command Line Tools installed[ok] lightshell.json found[ok] Entry file index.html found[warn] No build.appId set — using default
All checks passed.Common Workflows
Section titled “Common Workflows”Create and Run a New App
Section titled “Create and Run a New App”lightshell init my-appcd my-applightshell devBuild for Distribution
Section titled “Build for Distribution”# macOSlightshell build --target dmg --sign
# Linuxlightshell build --target deblightshell build --target rpmlightshell build --target appimageCheck Environment Before Building
Section titled “Check Environment Before Building”lightshell doctorlightshell buildDebug a Production Build
Section titled “Debug a Production Build”lightshell build --devtoolsopen dist/MyApp.appPlatform Notes
Section titled “Platform Notes”- On macOS,
lightshell buildrequires Xcode Command Line Tools (xcode-select --install). - On Linux,
lightshell buildrequireslibwebkit2gtk-4.1-devandlibgtk-3-devpackages. - The
--signand--notarizeflags are macOS-only. They are silently ignored on Linux. --notarizerequires Apple Developer credentials. SetAPPLE_IDandAPPLE_TEAM_IDenvironment variables or pass them interactively.- The
dist/directory is created automatically. Previous builds indist/are not cleaned — remove manually if needed. - Cross-compilation is not supported in v1. Build on the target platform.