← Back to BSD Macao

🦞 Clawdbot on FreeBSD

Run your own AI assistant natively on FreeBSD

Contents

Overview

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 Clawdbot to run natively on FreeBSD by building the required native Node.js modules from source.

Requirements

Installation

The easiest way to install is using our automated script:

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

This script will:

  1. Install Node.js 22, npm, and build tools (Rust, GCC, Python)
  2. Install Clawdbot via npm
  3. Build native modules for FreeBSD (clipboard, sharp)
  4. Create the clawdbot 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 Clawdbot
npm install -g clawdbot

# Build native modules
cd /usr/local/lib/node_modules/clawdbot
npm install node-addon-api node-gyp --save-dev

# Build clipboard for FreeBSD
cd node_modules/@mariozechner/clipboard
npm install @napi-rs/cli
npx napi build --platform --release

# Rebuild sharp
cd /usr/local/lib/node_modules/clawdbot
npm rebuild sharp

Configuration

After installation, initialize Clawdbot:

# As the clawdbot user
su -m clawdbot -c 'clawdbot onboard --mode local --workspace /var/db/clawdbot/workspace'

Then configure your AI provider:

su -m clawdbot -c 'clawdbot configure'

You'll need an API key from one of:

Running as a Service

Enable and start Clawdbot as a system service:

# Enable the service
sysrc clawdbot_enable=YES

# Start Clawdbot
service clawdbot start

# Check status
service clawdbot status

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

Telegram Setup

To connect Clawdbot 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 -m clawdbot -c 'clawdbot config set channels.telegram.botToken "YOUR_BOT_TOKEN"'

Restart the service to apply:

service clawdbot restart

Troubleshooting

Gateway won't start

Check that the config exists:

ls -la /var/db/clawdbot/.clawdbot/clawdbot.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/clawdbot/node_modules/@mariozechner/clipboard
npx napi build --platform --release

Permission errors

Ensure the clawdbot user owns its home directory:

chown -R clawdbot:clawdbot /var/db/clawdbot

Check logs

Service logs go to /var/log/clawdbot.log. Clawdbot also logs to:

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