Getting Started with Hammer CLI
Install the Hammer CLI and build your first site from the terminal in under a minute.
Installation
There are two ways to install Hammer CLI:
Option 1: Install from the Hammer App
If you already have Hammer for Mac installed, you can install the CLI directly from the app:
- Open Hammer
- Go to Hammer → Settings (or press
⌘,) - Click Install CLI
This installs the hammer binary to your system PATH so it's available in any terminal session.
Option 2: Standalone CLI Installer
You can also install the CLI separately without the Hammer app. Download the CLI installer from the Hammer downloads page and follow the installer instructions.
Verifying Your Installation
After installing, open your terminal and verify the CLI is working:
hammer --version
You should see output like:
Hammer 0.1.0
You can also view the full list of available commands:
hammer --help
Your First Build
Building a Hammer site from the terminal is as simple as navigating to your project and running hammer:
cd ~/Sites/my-site
hammer build
Hammer processes your HTML templates, includes, variables, CSS, and content files, then writes the output to a Build/ directory inside your project:
Source: /Users/me/Sites/my-site
Output: /Users/me/Sites/my-site/Build
✔ Build succeeded in 245ms
42 files processed
Build size: 1.2 MB
hammer with no subcommand is equivalent to hammer build. You can simply type hammer to build.
Any Directory is a Hammer Project
Hammer doesn't require a configuration file for basic sites. Any directory containing HTML, CSS, and JavaScript files is a valid Hammer project. The CLI will process Hammer tags (@include, @variable, @path, etc.) in your HTML files and compile everything into the Build/ directory.
Advanced features like Content Mode activate only when a content.config.json file is present. See Project Structure for details on how the CLI detects and configures projects.
Building in Different Modes
Hammer CLI supports three build modes that control which content is included:
| Mode | Drafts | Use |
|---|---|---|
normal |
Included | Local development and preview |
export |
Excluded | Distribution, archiving, static hosting |
publish |
Excluded | Deployment to Forge |
Use the --mode flag to select a mode:
# Development build (includes drafts)
hammer build
# Production build for Forge
hammer build --mode publish
# Export for any static host
hammer build --mode export
Checking Your Content
If your project uses Content Mode, you can validate all content files against your schema before building:
hammer check
This verifies that required fields are present, content files parse correctly, templates exist, and collection directories are in place. A passing check looks like:
✔ 128 files validated
Use --strict to treat warnings as errors — useful in CI/CD pipelines where you want the build to fail on any issue:
hammer check --strict
Quick Diagnostics
If something isn't working as expected, hammer doctor checks that your project environment is healthy:
hammer doctor
Hammer Doctor
─────────────
✔ Project found: /Users/me/Sites/my-site
✔ Source directory readable: OK
✔ Build directory writable: OK (will be created on build)
✔ Content config valid: 2 collections defined
✔ Collection 'posts' directory: OK
✔ Collection 'posts' template: OK
✔ Ignore patterns: 3 patterns configured
7/7 checks passed
And hammer info gives you a snapshot of your project configuration:
hammer info
Next Steps
Now that you have the CLI installed and running, explore further:
- Command Reference — Full options and output for every command
- Project Structure — How the CLI finds and configures projects
- Automation & CI/CD — Script your builds and integrate with deployment pipelines