This guide explains how to install OpenClaw in development mode, where the application is built from source instead of installed from npm.
| Feature | Release Mode | Development Mode |
|---|---|---|
| Source | npm registry | GitHub repository |
| Installation | pnpm install -g openclaw@latest |
git clone + pnpm build |
| Location | ~/.local/share/pnpm/global/... |
~/code/openclaw/ |
| Binary | Global pnpm package | Symlink to bin/openclaw.js |
| Updates | pnpm install -g openclaw@latest |
git pull + pnpm build |
| Use Case | Production, stable deployments | Development, testing, debugging |
| Recommended For | End users | Developers, contributors |
# Clone the ansible installer
git clone https://github.com/openclaw/openclaw-ansible.git
cd openclaw-ansible
# Run in development mode
./run-playbook.sh -e openclaw_install_mode=development# Install ansible
sudo apt update && sudo apt install -y ansible git
# Clone repository
git clone https://github.com/openclaw/openclaw-ansible.git
cd openclaw-ansible
# Install collections
ansible-galaxy collection install -r requirements.yml
# Run playbook with development mode
ansible-playbook playbook.yml --ask-become-pass -e openclaw_install_mode=development/home/openclaw/
├── .openclaw/ # Configuration directory
│ ├── sessions/
│ ├── credentials/
│ ├── data/
│ └── logs/
├── .local/
│ ├── bin/
│ │ └── openclaw # Symlink -> ~/code/openclaw/bin/openclaw.js
│ └── share/pnpm/
└── code/
└── openclaw/ # Git repository
├── bin/
│ └── openclaw.js
├── dist/ # Built files
├── src/ # Source code
├── package.json
└── pnpm-lock.yaml
The Ansible playbook performs these steps:
-
Create
~/codedirectorymkdir -p ~/code -
Clone repository
cd ~/code git clone https://github.com/openclaw/openclaw.git
-
Install dependencies
cd openclaw pnpm install -
Build from source
pnpm build
-
Create symlink
ln -sf ~/code/openclaw/bin/openclaw.js ~/.local/bin/openclaw chmod +x ~/code/openclaw/bin/openclaw.js
-
Add development aliases to
.bashrc:alias openclaw-rebuild='cd ~/code/openclaw && pnpm build' alias openclaw-dev='cd ~/code/openclaw' alias openclaw-pull='cd ~/code/openclaw && git pull && pnpm install && pnpm build'
# 1. Navigate to repository
openclaw-dev
# or: cd ~/code/openclaw
# 2. Make your changes
vim src/some-file.ts
# 3. Rebuild
openclaw-rebuild
# or: pnpm build
# 4. Test immediately
openclaw --version
openclaw doctor# Pull latest changes and rebuild
openclaw-pull
# Or manually:
cd ~/code/openclaw
git pull
pnpm install
pnpm build# After rebuilding, the openclaw command uses the new code immediately
openclaw status
openclaw gateway
# View daemon logs
openclaw logscd ~/code/openclaw
# Switch to feature branch
git checkout feature-branch
pnpm install
pnpm build
# Switch back to main
git checkout main
pnpm install
pnpm buildThe following aliases are added to .bashrc:
| Alias | Command | Purpose |
|---|---|---|
openclaw-dev |
cd ~/code/openclaw |
Navigate to repo |
openclaw-rebuild |
cd ~/code/openclaw && pnpm build |
Rebuild after changes |
openclaw-pull |
cd ~/code/openclaw && git pull && pnpm install && pnpm build |
Update and rebuild |
Plus an environment variable:
export OPENCLAW_DEV_DIR="$HOME/code/openclaw"You can customize the development installation:
# In playbook or command line
openclaw_install_mode: "development"
openclaw_repo_url: "https://github.com/openclaw/openclaw.git"
openclaw_repo_branch: "main"
openclaw_code_dir: "/home/openclaw/code"
openclaw_repo_dir: "/home/openclaw/code/openclaw"ansible-playbook playbook.yml --ask-become-pass \
-e openclaw_install_mode=development \
-e openclaw_repo_url=https://github.com/YOUR_USERNAME/openclaw.git \
-e openclaw_repo_branch=your-feature-branchansible-playbook playbook.yml --ask-become-pass \
-e openclaw_install_mode=development \
-e openclaw_code_dir=/home/openclaw/projects# Uninstall global package
pnpm uninstall -g openclaw
# Run ansible in development mode
ansible-playbook playbook.yml --ask-become-pass -e openclaw_install_mode=development# Remove symlink
rm ~/.local/bin/openclaw
# Remove repository (optional)
rm -rf ~/code/openclaw
# Install from npm
pnpm install -g openclaw@latestcd ~/code/openclaw
# Check Node.js version (needs 22.x)
node --version
# Clean install
rm -rf node_modules
pnpm install
pnpm build# Check symlink
ls -la ~/.local/bin/openclaw
# Recreate symlink
rm ~/.local/bin/openclaw
ln -sf ~/code/openclaw/bin/openclaw.js ~/.local/bin/openclaw
chmod +x ~/code/openclaw/bin/openclaw.js# Ensure ~/.local/bin is in PATH
echo $PATH | grep -q ".local/bin" || echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrccd ~/code/openclaw
# Reset to clean state
git reset --hard origin/main
git clean -fdx
# Rebuild
pnpm install
pnpm buildFirst build takes longer (~1-2 minutes depending on system):
pnpm install # Downloads dependencies
pnpm build # Compiles TypeScriptSubsequent rebuilds are faster (~10-30 seconds):
pnpm build # Only recompiles changed filesDevelopment mode uses more disk space:
- Release mode: ~150 MB (global pnpm cache)
- Development mode: ~400 MB (repo + node_modules + dist)
No difference in runtime memory usage between modes.
# Test specific commit
cd ~/code/openclaw
git fetch origin pull/123/head:pr-123
git checkout pr-123
pnpm install
pnpm build
# Test it
openclaw doctor#!/bin/bash
# test-openclaw.sh
cd ~/code/openclaw
git pull
pnpm install
pnpm build
# Run tests
pnpm test
# Integration test
openclaw doctor-
✅ Always rebuild after code changes
openclaw-rebuild
-
✅ Test changes before committing
pnpm build && openclaw doctor -
✅ Keep dependencies updated
pnpm update pnpm build
-
✅ Use feature branches
git checkout -b feature/my-feature
- ❌ Editing code without rebuilding
- ❌ Running
pnpm linkmanually (breaks setup) - ❌ Installing global packages while in dev mode
- ❌ Modifying symlink manually
You can have multiple clones:
# Main development
~/code/openclaw/ # main branch
# Experimental features
~/code/openclaw-test/ # testing branch
# Switch binary symlink
ln -sf ~/code/openclaw-test/bin/openclaw.js ~/.local/bin/openclawcd ~/code/openclaw
# Development build (faster, includes source maps)
NODE_ENV=development pnpm build
# Production build (optimized)
NODE_ENV=production pnpm build# Run with debug output
DEBUG=* openclaw gateway
# Or specific namespaces
DEBUG=openclaw:* openclaw gateway