Getting Started

Complete OpenClaw Setup Guide (Mac, Linux & Windows)

Step-by-step installation and configuration. Get your AI automation running in 15 minutes β€” from zero to a working Telegram bot with your first cron job.

🦞 claw.mobile Editorial·March 22, 2026·
15 min read
⏱️
15 min
Setup time
πŸ“¦
v2026.3
Current version
πŸ’»
Mac/Linux/Win
Platforms
πŸ†“
Free
To install

Why OpenClaw Is Worth Setting Up

Most AI tools are reactive β€” you open an app, type a question, and get an answer. OpenClaw is fundamentally different: it's a persistent, always-on AI agent that lives on your machine, connects to your messaging apps, runs scheduled automations, and remembers context across sessions. Once it's set up, your AI works for you around the clock β€” not just when you remember to ask it something.

In practical terms, this means you can message your agent from Telegram at 7am and get a pre-built morning brief β€” weather, calendar, crypto prices, email summary β€” all assembled automatically before you even open your laptop. You can set it to monitor a GitHub repo, draft and send weekly reports, or alert you whenever a specific event happens. The setup takes about 15 minutes, and the typical monthly cost runs $5–$20 depending on usage β€” often less than a single ChatGPT Pro subscription.

This guide walks you through a complete installation from scratch. If you want the full 20-phase walkthrough covering advanced topics like multi-agent setups, Tailscale networking, and production hardening, head over to the main OpenClaw Guide after finishing here.

Prerequisites

OpenClaw is a Node.js application, so the main thing you need is a modern version of Node installed. You'll also need an API key from at least one AI provider β€” Anthropic (Claude) and OpenAI (GPT-4) are the most popular choices. If you're cost-conscious, Google Gemini Flash is an excellent low-cost option for background tasks like heartbeats and cron summaries.

πŸ“¦
Node.js 22+(LTS recommended) β€” Download from nodejs.org
Required
πŸ”‘
An API keyfrom OpenAI, Anthropic, or another supported provider
Required
πŸ’»
Terminal accessTerminal.app on Mac, any terminal on Linux/Windows
Required
⏱️
15 minutesof uninterrupted time

Use Node 24 if available β€” it's the most tested version with OpenClaw. Check your version with node --version

Installation

OpenClaw is distributed as a global npm package. Installing it globally makes the openclaw command available system-wide, so you can run it from any directory. This is the only installation method currently supported β€” unlike some tools, OpenClaw is designed to run as a persistent daemon on your machine rather than inside a specific project directory.

Terminal
npm install -g openclaw@latest

This installs OpenClaw globally. The package includes the CLI, the gateway server, and all built-in skills. Wait for the installation to complete β€” typically 1–2 minutes on a normal connection. You'll see npm download and link several dependencies; this is expected.

If you get permission errors on Mac/Linux, use: sudo npm install -g openclaw@latest. Alternatively, configure npm to use a user-writable directory with npm config set prefix ~/.npm-global to avoid needing sudo.

Once installation finishes, verify it worked by checking the version number. If the command is found and prints a version, you're ready for configuration:

Terminal
openclaw --version

You should see the version number (e.g., 2026.3.8). If you get "command not found", try restarting your terminal or check that your npm global bin directory is on your PATH.

Initial Configuration

The fastest way to get configured is the built-in onboarding wizard. It walks you through provider selection, API key entry, workspace creation, and daemon setup β€” all in one interactive flow. Your API key is stored locally in ~/.openclaw/config/ and is never transmitted anywhere outside your chosen provider's API.

Terminal
openclaw onboard --install-daemon

The --install-daemon flag registers OpenClaw as a system service so it starts automatically at login β€” highly recommended for automation use cases. The wizard will guide you through these four steps:

  1. 1Choosing your primary AI provider (Anthropic, OpenAI, Google)
  2. 2Entering your API key (stored locally, never sent anywhere else)
  3. 3Setting up your workspace directory (~/.openclaw/workspace/)
  4. 4Installing as a background daemon (auto-starts on boot)

If you prefer to configure manually β€” for example, to set up dual models (one fast, one capable) or to configure multiple providers β€” edit the config file directly. The heartbeat model handles background tasks like cron summaries and is worth pointing at a cheaper model such as Gemini Flash to reduce costs. See our cost calculator to estimate your monthly spend across different model configurations.

~/.openclaw/config/openclaw.json
{
  "model": {
    "default": "anthropic/claude-sonnet-4-6",
    "heartbeat": "google/gemini-flash-lite"
  },
  "providers": {
    "anthropic": {
      "apiKey": "sk-ant-YOUR_KEY_HERE"
    }
  }
}

First Run & Testing

The OpenClaw gateway is the core server process that routes messages, executes tools, and manages channel connections. You need it running before any other functionality works. Start it with:

Terminal
openclaw gateway start

The gateway binds to port 18789 by default and exposes a local HTTP interface for message routing and management. You should see a confirmation line appear within a few seconds. If you installed the daemon, this starts automatically at login β€” but for your first run you'll start it manually to watch the output.

Look for: βœ“ Gateway ready on http://localhost:18789

Once the gateway is running, send a test message directly from the CLI to verify your API key and model are working correctly. This bypasses any channel configuration and tests the core AI layer in isolation:

Terminal
openclaw send --message "Hello, OpenClaw! What's today's date?"

If you get a response with the correct date, everything is working. Your API key is valid, the model is reachable, and the gateway is running. Proceed to connect Telegram.

Connecting Telegram

Telegram is the recommended channel for OpenClaw β€” it's fast, reliable, free, and works perfectly as a mobile interface to your agent. The integration uses a Telegram Bot token, which you get by talking to @BotFather β€” Telegram's official bot-creation service. The whole process takes about 3 minutes.

Terminal
openclaw channel add telegram

The command will prompt you to open Telegram and message @BotFather. Send it /newbot, choose a name and username for your bot, and BotFather will reply with a token that looks like 1234567890:ABC-DEF1234.... Paste that token into the CLI prompt and OpenClaw will handle the rest β€” registering the webhook, configuring your user ID as an allowed sender, and starting to listen for messages.

After setup, open Telegram, find your new bot, and send it a message. You should get a reply within a second or two. If it takes longer, check that the gateway is still running and that your bot token is correct in the config.

Other Channels

You can connect additional channels alongside Telegram. Each one adds a new input/output surface for your agent:

Discord

openclaw channel add discord

WhatsApp

openclaw channel add whatsapp

iMessage

openclaw channel add imessage (Mac only)

Slack

openclaw channel add slack

Your First Automation: Morning Brief

Now that your agent is running and connected to Telegram, let's set up a real automation. A morning brief is the perfect first cron job β€” it demonstrates how OpenClaw can pull together multiple data sources (weather, calendar, news) and push a formatted summary to you every morning, completely automatically.

OpenClaw uses standard cron syntax for scheduled tasks. Create a file called CRONS.md in your workspace directory. Each cron entry specifies a schedule and a prompt that your agent will execute at that time:

~/.openclaw/workspace/CRONS.md
# Morning Brief
schedule: 0 7 * * 1-5
prompt: >
  Good morning! Please prepare my daily brief:
  1. Today's weather for Belgrade
  2. Any calendar events today (check Google Calendar)
  3. Top 3 crypto prices (BTC, ETH, SOL)
  4. Any unread emails flagged as important
  Send the brief to my Telegram channel.

This cron runs at 7:00am on weekdays (Monday–Friday). The agent will execute the prompt, gather the requested data using its built-in tools, format a clean summary, and send it to your Telegram β€” all without you doing anything. For a more detailed walkthrough of morning brief customization options, see the Automated Morning Routine guide.

After saving the file, reload your workspace so OpenClaw picks up the new cron:

Terminal
openclaw workspace reload

Setting Up Your Workspace

The workspace directory is where you define your agent's personality, memory, and behavior. Think of it as the agent's brain β€” a set of plain Markdown files that OpenClaw reads on startup and injects into every conversation as context. This is what makes your agent feel like your agent rather than a generic chatbot.

~/.openclaw/workspace/ structure
~/.openclaw/workspace/
β”œβ”€β”€ SOUL.md      # Agent personality & behavior rules
β”œβ”€β”€ USER.md      # About you: timezone, style, goals
β”œβ”€β”€ MEMORY.md    # Persistent facts your agent should know
β”œβ”€β”€ AGENTS.md    # Agent topology (single or multi-agent)
└── CRONS.md     # Scheduled automations (cron jobs)

The most impactful files to set up first are USER.md and SOUL.md. USER.md tells your agent your timezone, communication style, and goals β€” so it can format responses appropriately and understand your context without you re-explaining it each time. SOUL.md defines the agent's personality, name, and rules.

See the Memory System guide for details on each file and how LCM (Lossless Context Management) keeps memory across long sessions.

Troubleshooting

Most issues during initial setup fall into a few predictable categories. Here are the most common errors and how to fix them. If none of these solve your problem, check the logs with openclaw gateway logs --tail β€” the output usually points directly at the issue.

"command not found: openclaw"

Restart your terminal or run: source ~/.zshrc (or ~/.bashrc). This happens when your npm global bin directory isn't on your PATH. Check the correct path with npm bin -g and add it to your shell profile.

"Port 18789 already in use"

Another OpenClaw process is already running (or a previous one didn't exit cleanly). Kill it with: lsof -ti:18789 | xargs kill -9 β€” then run openclaw gateway start again. If you're running the daemon, use openclaw gateway restart instead.

API key errors or "invalid_api_key"

Check your key is correct in ~/.openclaw/config/openclaw.json. Make sure there are no extra spaces, quotes, or newlines around the key value. Verify the key works directly on the provider's dashboard. Also confirm you're using the right provider prefix (e.g., "anthropic/" for Claude models).

Bot not responding on Telegram

Most likely cause: the gateway isn't running (openclaw gateway status will tell you), or your Telegram user ID isn't in allowedUserIds in the config. Your user ID is different from your username β€” get it by messaging @userinfobot on Telegram.

Cron jobs not triggering

Make sure CRONS.md is saved inside your workspace directory and the workspace is loaded. Run openclaw workspace reload after any changes to CRONS.md. Also verify cron syntax at crontab.guru β€” a common mistake is using 5-part cron (minute hour day month weekday) correctly.

Next Steps

Congratulations β€” you have a working AI agent. But this is just the foundation. OpenClaw's real power comes from the 20-phase setup covered in the full OpenClaw Guide, which walks through advanced topics like multi-agent architectures, custom skills, Tailscale remote access, and production-grade security hardening. In the meantime, these posts cover the most useful next steps:

We use cookies for analytics. Learn more
Run your own AI agent for $6/month β†’