OpenClaw is the most popular open-source AI agent framework, with over 180,000 GitHub stars. It runs on your machine, connects to messaging platforms like Telegram and Discord, and actually does things β schedules tasks, browses the web, writes code, manages files, and remembers everything between sessions.
This guide walks you through every step: installing OpenClaw, configuring your first agent, connecting it to Telegram, setting up cron jobs, and keeping it running 24/7. Whether you're on Mac, Linux, or Windows, you'll have a working AI agent by the end.
Or, if you'd rather skip the setup entirely, LobsterLair gives you a fully managed OpenClaw instance in 2 minutes β AI included, no API key needed, $19/month, cancel anytime.
Prerequisites
Before installing OpenClaw, you need:
- Node.js 22 or newer β OpenClaw requires a modern Node.js runtime
- An AI provider API key β Anthropic (Claude), OpenAI (GPT), Google (Gemini), or any OpenAI-compatible provider
- A terminal β Command line access on your OS
Installing Node.js
If you don't have Node.js 22+ installed:
Mac (Homebrew):
brew install node@22
Ubuntu/Debian:
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs
Windows: Download the installer from nodejs.org and run it. Choose the LTS version (22+).
Verify your installation:
node --version
# Should show v22.x.x or higher
Method 1: Quick Install (npx)
The fastest way to get OpenClaw running. No permanent installation needed β npx downloads and runs it directly:
npx openclaw
That's it. OpenClaw starts an interactive session where you can chat with your agent. On first run, it'll ask you to configure an AI provider.
This method is great for trying OpenClaw out, but it won't persist between terminal sessions. For a permanent setup, use Method 2 or 3.
Method 2: Global Install (npm)
Install OpenClaw globally so you can run it from anywhere:
npm install -g openclaw
Now you can run it with:
openclaw
Verify the Installation
openclaw --version
This should print the installed version number. If you get a "command not found" error, make sure your npm global bin directory is in your PATH:
# Find where npm installs global packages
npm config get prefix
# Add to PATH (add this to your .bashrc or .zshrc)
export PATH="$(npm config get prefix)/bin:$PATH"
Method 3: Docker Install
Docker is the recommended method for running OpenClaw as a persistent service. It isolates the agent in a container and makes it easy to manage.
Install Docker
Mac: Download Docker Desktop
Ubuntu/Debian:
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER
# Log out and back in for group changes to take effect
Windows: Download Docker Desktop
Run OpenClaw in Docker
Pull and run the official image:
docker run -d \
--name openclaw \
--restart unless-stopped \
-v openclaw-data:/home/node/.openclaw \
openclaw/openclaw:latest \
gateway
This starts OpenClaw in gateway mode (persistent daemon) with a named volume for data persistence.
Check It's Running
docker logs openclaw --tail 50
You should see the gateway starting up and initializing.
Initial Configuration
After installation, OpenClaw needs to know which AI model to use. The main config file is openclaw.json, located in your OpenClaw state directory:
- Local install:
~/.openclaw/openclaw.json - Docker: Inside the container at
/home/node/.openclaw/openclaw.json
Setting Up Your AI Provider
Create or edit openclaw.json:
{
"agents": {
"defaults": {
"model": {
"primary": "anthropic/claude-sonnet-4-6"
}
}
},
"gateway": {
"port": 18789,
"bind": "lan",
"auth": {
"mode": "token",
"token": "your-secret-token-here"
}
}
}
Set your API key as an environment variable:
# For Anthropic Claude
export ANTHROPIC_API_KEY="sk-ant-..."
# For OpenAI GPT
export OPENAI_API_KEY="sk-..."
# For Google Gemini
export GEMINI_API_KEY="AI..."
To make this permanent, add the export line to your ~/.bashrc or ~/.zshrc.
Running the Doctor
OpenClaw has a built-in config validator:
openclaw doctor
This checks your configuration, verifies API connectivity, and fixes common issues automatically.
Setting Up the Gateway (24/7 Operation)
The gateway is what makes OpenClaw run persistently β handling cron jobs, message routing, and channel connections. Without it, your agent only runs when you manually start a session.
Start the Gateway
openclaw gateway
This starts the daemon process. It runs in the foreground, so you'll want to use a process manager for 24/7 operation.
Using systemd (Linux)
Create a service file at /etc/systemd/system/openclaw.service:
[Unit]
Description=OpenClaw AI Agent Gateway
After=network.target
[Service]
Type=simple
User=openclaw
Environment=ANTHROPIC_API_KEY=sk-ant-...
WorkingDirectory=/home/openclaw
ExecStart=/usr/bin/npx openclaw gateway
Restart=unless-stopped
RestartSec=10
[Install]
WantedBy=multi-user.target
Enable and start:
sudo systemctl daemon-reload
sudo systemctl enable openclaw
sudo systemctl start openclaw
Check status:
sudo systemctl status openclaw
sudo journalctl -u openclaw -f # Live logs
Using Docker (Recommended)
If you installed via Docker (Method 3), the gateway is already running with --restart unless-stopped. It survives reboots automatically.
Connecting Telegram
Telegram is the most popular channel for OpenClaw. Here's how to set it up:
1. Create a Telegram Bot
- Open Telegram and message @BotFather
- Send
/newbot - Choose a name and username for your bot
- Copy the bot token (looks like
7123456789:AAHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
2. Get Your User ID
- Message @userinfobot on Telegram
- It replies with your numeric user ID (e.g.,
123456789)
3. Add Telegram to openclaw.json
Add a channels section to your config:
{
"agents": {
"defaults": {
"model": {
"primary": "anthropic/claude-sonnet-4-6"
}
}
},
"gateway": {
"port": 18789,
"bind": "lan",
"auth": {
"mode": "token",
"token": "your-secret-token-here"
}
},
"channels": {
"telegram": {
"enabled": true,
"botToken": "7123456789:AAHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"dmPolicy": "allowlist",
"allowFrom": ["123456789"],
"groupPolicy": "disabled",
"streaming": "partial"
}
},
"plugins": {
"entries": {
"telegram": {
"enabled": true
}
}
}
}
Important: The plugins.entries.telegram.enabled: true line is required. Without it, OpenClaw's config doctor will disable the Telegram plugin even though the channel is configured.
4. Restart the Gateway
# systemd
sudo systemctl restart openclaw
# Docker
docker restart openclaw
5. Test It
Open Telegram, find your bot, and send it a message. It should respond within a few seconds.
Installing Skills
Skills extend what your agent can do. The official registry is ClawHub.
# Install the GitHub skill
clawhub install github
# Install browser automation
clawhub install playwright
# Install web search
clawhub install brave-search
# List installed skills
clawhub list
Skills are loaded automatically β no restart needed.
Setting Up Cron Jobs
Cron jobs let your agent run tasks on a schedule, completely autonomously.
Example: Daily News Summary at 9 AM
openclaw cron add \
--schedule "0 9 * * *" \
--prompt "Check the latest tech news and send me a summary of the top 5 stories"
Example: Weekly Accountability Check
openclaw cron add \
--schedule "0 10 * * 0" \
--prompt "Review my goals for the week and give me a progress report"
Managing Cron Jobs
# List all cron jobs
openclaw cron list
# Remove a cron job
openclaw cron remove <job-id>
Customizing Your Agent's Personality
OpenClaw uses markdown files for personality and memory:
SOUL.md
Create ~/.openclaw/workspace/SOUL.md (or /home/node/.openclaw/workspace/SOUL.md in Docker):
You are Alex, a helpful AI assistant.
You're friendly but concise.
You use bullet points when listing things.
You always confirm before taking destructive actions.
MEMORY.md
The agent maintains its own memory in MEMORY.md. You can read it, edit it, or clear it. The agent updates it automatically to remember important context between sessions.
Browser Automation (Chromium)
Many skills need a browser. OpenClaw uses Chromium via CDP (Chrome DevTools Protocol).
Local Install
Install Chromium:
# Mac
brew install --cask chromium
# Ubuntu/Debian
sudo apt install -y chromium-browser
OpenClaw detects Chromium automatically. If it can't find it, set the path in openclaw.json:
{
"browser": {
"executablePath": "/usr/bin/chromium-browser"
}
}
Docker
In Docker, you need a Chromium-ready image. The official image includes Chromium, but if you're building your own, install the required dependencies:
apt install -y chromium fonts-liberation libatk-bridge2.0-0 libgtk-3-0
Common Issues and Fixes
"Command not found: openclaw"
Your npm global bin directory isn't in your PATH. Fix:
export PATH="$(npm config get prefix)/bin:$PATH"
Add this line to your ~/.bashrc or ~/.zshrc to make it permanent.
"No API key found for provider"
Set the API key environment variable for your provider:
export ANTHROPIC_API_KEY="sk-ant-..."
For Docker, pass it with -e:
docker run -e ANTHROPIC_API_KEY="sk-ant-..." ...
Telegram Bot Not Responding
- Check the bot token is correct (message @BotFather to verify)
- Ensure
plugins.entries.telegram.enabledistrue - Check your user ID is in the
allowFromlist - Look at the gateway logs for connection errors
High CPU After Startup
This is normal. OpenClaw indexes files and compiles skills on first startup, which can spike CPU to 100% for 30-60 seconds. It settles to near-zero afterward.
Gateway Crashes on Restart
Check your openclaw.json for syntax errors:
openclaw doctor
Keeping OpenClaw Updated
OpenClaw releases updates frequently with new features, bug fixes, and security patches.
npm Update
npm update -g openclaw
Docker Update
docker pull openclaw/openclaw:latest
docker stop openclaw
docker rm openclaw
docker run -d \
--name openclaw \
--restart unless-stopped \
-v openclaw-data:/home/node/.openclaw \
openclaw/openclaw:latest \
gateway
Always check the release notes before updating. Major version updates can include breaking changes to config format or skill APIs.
The Easier Way: Skip All of This
If you've read this far and thought "that's a lot of steps" β you're not wrong. Installing OpenClaw is straightforward for developers, but keeping it running 24/7 with updates, backups, monitoring, and security is an ongoing commitment.
LobsterLair handles all of this for you:
- 2-minute setup β Sign up, name your bot, optionally connect Telegram, done
- AI included β No API key needed. We provide MiniMax M2.5 (200K context window)
- Always online β Isolated Docker containers with automatic restarts
- Automatic updates β We roll out new OpenClaw versions with zero downtime
- Daily backups β Your bot's memory and config, backed up offsite
- Browser automation β Chromium, ffmpeg, yt-dlp, whisper, and 500+ tools pre-installed
- Cancel anytime β No contracts, no hidden fees
$19/month. That's less than most people spend on their AI provider API key alone.
Get started at lobsterlair.xyz
Summary
Here's what you need to install OpenClaw yourself:
| Step | Time | Difficulty |
|---|---|---|
| Install Node.js | 5 min | Easy |
| Install OpenClaw | 2 min | Easy |
| Configure AI provider | 10 min | Medium |
| Start gateway | 5 min | Easy |
| Connect Telegram | 15 min | Medium |
| Set up as service (systemd/Docker) | 30 min | Medium |
| Install skills | 10 min | Easy |
| Set up cron jobs | 10 min | Easy |
| Backups & monitoring | 1-2 hours | Hard |
| Total | ~2-3 hours |
OpenClaw is a powerful framework and worth every minute of setup if you enjoy running your own infrastructure. But if you'd rather spend those 2-3 hours actually using your AI agent instead of installing it, LobsterLair has you covered.