Install
openclaw skills install safe-updateUpdate OpenClaw from source code. Supports custom project path and branch. Includes pulling latest branch, rebasing, building and installing, restarting service. Triggered when user asks to update OpenClaw, sync source, rebase branch, or rebuild.
openclaw skills install safe-updateUpdate OpenClaw from source to the latest version while preserving local changes.
Required binaries (must be installed):
gitnpm / nodesystemctl (for restarting gateway)# Set custom project path
export OPENCLAW_PROJECT_DIR="/path/to/openclaw"
# Set custom branch (default: main)
export OPENCLAW_BRANCH="your-feature-branch"
# Enable dry-run mode (no actual changes)
export DRY_RUN="true"
./update.sh --dir /path/to/openclaw --branch your-branch
Before executing any update, check:
Recommended Strategy:
| Scenario | Recommended Method | Rationale |
|---|---|---|
| Uncommitted local changes | Commit/stash first, then merge | Safe, no lost changes |
| Only clean local commits | merge or rebase | merge is safer, rebase keeps history clean |
| Preparing a PR | rebase recommended | Keeps history tidy |
| Routine dev update | merge recommended | Simple, less error-prone |
After presenting the recommended options, you must wait for user confirmation before executing.
# 1. Enter project directory
cd "${OPENCLAW_PROJECT_DIR:-$HOME/projects/openclaw}"
# 2. Backup config files (good practice before update!)
echo "=== Backing up config files ==="
mkdir -p ~/.openclaw/backups
BACKUP_SUFFIX=$(date +%Y%m%d-%H%M%S)
# Backup main config
cp ~/.openclaw/openclaw.json ~/.openclaw/backups/openclaw.json.bak.$BACKUP_SUFFIX
echo "✅ Backed up: openclaw.json"
# Backup auth profiles (if exists)
if [ -f ~/.openclaw/agents/main/agent/auth-profiles.json ]; then
cp ~/.openclaw/agents/main/agent/auth-profiles.json \
~/.openclaw/backups/auth-profiles.json.bak.$BACKUP_SUFFIX
echo "✅ Backed up: auth-profiles.json"
fi
echo "💡 Backups saved to: ~/.openclaw/backups/"
echo ""
# 3. Add upstream repository (if not added)
git remote add upstream https://github.com/openclaw/openclaw.git 2>/dev/null || true
# 4. Fetch upstream changes
git fetch upstream
# 5. Update target branch (use merge or rebase based on user's choice)
git checkout $BRANCH
# merge: git merge upstream/$BRANCH
# rebase: git rebase upstream/$BRANCH
# 6. View changelog
echo "=== Full Changelog ==="
CURRENT_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v$(node -e 'console.log(require("./package.json").version)')")
echo "Current version: $CURRENT_TAG"
echo ""
# 7. Build and install
npm run build
npm i -g .
# 8. Reinstall systemd service (to update version number)
echo "=== Reinstalling Gateway service ==="
openclaw daemon install --force
# 9. Check version
NEW_VERSION=$(openclaw --version)
echo "✅ Update complete! New version: $NEW_VERSION"
echo ""
# 10. Ask user whether to restart
echo "=== Gateway needs restart to apply updates ==="
echo "Confirm restart? (y/N)"
Run scripts/update.sh to automatically complete all steps above.
./update.sh [OPTIONS]
Options:
--dir PATH OpenClaw project directory (default: $HOME/projects/openclaw)
--branch NAME Git branch to update (default: main)
--mode MODE Update mode: merge or rebase (if not specified, will analyze and recommend)
--dry-run Show what would be done without executing
--help Show this help message
# Update with defaults (will analyze and recommend)
./update.sh
# Update specific branch
./update.sh --branch feat/my-branch
# Force merge mode
./update.sh --mode merge
# Force rebase mode
./update.sh --mode rebase
# Dry run (preview only)
./update.sh --dry-run
# Custom project path
./update.sh --dir /opt/openclaw --branch main
git push --force# Resolve conflicts manually, then:
git add .
git rebase --continue
# Continue with build steps
# Clean and retry:
rm -rf node_modules dist
npm install
npm run build
# Check status:
systemctl --user status openclaw-gateway
# View logs:
journalctl --user -u openclaw-gateway -n 50