← Back to BSD Macao

🦞 OpenClaw on FreeBSD

Run your own AI assistant natively on FreeBSD

Contents

Overview

OpenClaw (formerly Moltbot/Clawdbot) is a self-hosted AI assistant that connects to messaging platforms (Telegram, WhatsApp, Discord, Slack, Signal) and provides an always-on AI assistant powered by Claude, GPT, or other LLM providers.

This port enables OpenClaw to run natively on FreeBSD by building the required native Node.js modules from source.

FreeBSD Limitation: Local LLM support (llama.cpp) is not available on FreeBSD. The installer uses --ignore-scripts to skip the node-llama-cpp build, which fails on FreeBSD. You must use API-based models (Claude, OpenAI, OpenRouter) instead of local models.

Requirements

Installation

We recommend downloading and reviewing the script first:

fetch https://bsdmacao.org/install/openclaw.sh
less openclaw.sh
sh openclaw.sh

Or if you prefer a one-liner:

fetch -o - https://bsdmacao.org/install/openclaw.sh | sh

The script will:

  1. Install Node.js 22, npm, and build tools (Rust, GCC, Python)
  2. Install OpenClaw via npm
  3. Build native modules for FreeBSD (clipboard, sharp)
  4. Create the openclaw system user
  5. Install the rc.d service script

Manual Installation

If you prefer to install manually:

# Install dependencies
pkg install node22 npm-node22 git rust gcc python311 pkgconf vips

# Install OpenClaw (--ignore-scripts required to skip node-llama-cpp build)
npm install -g --ignore-scripts openclaw

# Rebuild sharp for FreeBSD
cd /usr/local/lib/node_modules/openclaw
npm rebuild sharp

# Build clipboard for FreeBSD
cd node_modules/@mariozechner/clipboard
npm install @napi-rs/cli
npx napi build --platform --release
Why --ignore-scripts? OpenClaw includes node-llama-cpp for local LLM support. Its postinstall script tries to download cmake and build llama.cpp, which fails on FreeBSD. Using --ignore-scripts skips this, then we manually rebuild only the modules that work on FreeBSD (sharp and clipboard).

Configuration

After installation, initialize OpenClaw:

# As the openclaw user
su -l openclaw -c 'openclaw onboard --mode local --workspace /var/db/openclaw/workspace'

Then configure your AI provider:

su -l openclaw -c 'openclaw configure'

You'll need an API key from one of:

Running as a Service

Enable and start OpenClaw as a system service:

# Enable the service
sysrc openclaw_enable=YES

# Start OpenClaw
service openclaw start

# Check status
service openclaw status

# View logs
tail -f /var/log/openclaw.log
Note: OpenClaw uses gateway run (foreground mode) wrapped by the FreeBSD daemon utility. The standard openclaw gateway start/stop commands expect systemd/launchd and won't work on FreeBSD.

Telegram Setup

To connect OpenClaw to Telegram:

  1. Message @BotFather on Telegram
  2. Create a new bot with /newbot
  3. Copy the bot token
  4. Add the token to your config:
su -l openclaw -c 'openclaw config set channels.telegram.botToken "YOUR_BOT_TOKEN"'

Restart the service to apply:

service openclaw restart

Upgrading from Moltbot/Clawdbot

If you have an existing moltbot or clawdbot installation:

# Stop old service
service moltbot stop  # or: service clawdbot stop

# Run the new installer
fetch -o - https://bsdmacao.org/install/openclaw.sh | sh

# Migrate config (if needed)
cp -r /var/db/moltbot/.clawdbot/* /var/db/openclaw/.openclaw/
chown -R openclaw:openclaw /var/db/openclaw

# Start new service
sysrc openclaw_enable=YES
service openclaw start

Troubleshooting

Gateway won't start

Check that the config exists:

ls -la /var/db/openclaw/.openclaw/openclaw.json

If missing, run the onboard command again.

Native module errors

If you see errors about missing .node files, rebuild them:

cd /usr/local/lib/node_modules/openclaw/node_modules/@mariozechner/clipboard
npx napi build --platform --release

Permission errors

Ensure the openclaw user owns its home directory:

chown -R openclaw:openclaw /var/db/openclaw

Check logs

Service logs go to /var/log/openclaw.log. OpenClaw also logs to:

/tmp/openclaw/openclaw-YYYY-MM-DD.log
Need help? Open an issue on GitHub or check the official OpenClaw docs.