🦞 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.
--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
- FreeBSD 14.0 or later
- Root access (for installation)
- ~4GB disk space
- Internet connection
- An AI provider API key (Claude, OpenAI, etc.)
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:
- Install Node.js 22, npm, and build tools (Rust, GCC, Python)
- Install OpenClaw via npm
- Build native modules for FreeBSD (clipboard, sharp)
- Create the
openclawsystem user - 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
--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:
- Anthropic (Claude)
- OpenAI (GPT)
- OpenRouter (multiple providers)
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
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:
- Message @BotFather on Telegram
- Create a new bot with
/newbot - Copy the bot token
- 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