Not long ago, having a personal AI assistant that could read your emails, draft replies, search the web, and execute multi-step workflows on your behalf was the stuff of science fiction. Today, with the rise of open-source large language models, lightweight agent frameworks, and off-the-shelf integration tools, you can run exactly that on a Mac mini sitting on your desk—without paying a subscription fee to any cloud AI provider.
This article walks you through setting up OpenClaw, an open-source AI agent middleware platform that acts as a central nervous system between your preferred messaging interface (Telegram), your email (Gmail), and your local or cloud-hosted LLM (Ollama). By the end of this guide, you will have a fully operational AI agent you can chat with via Telegram, have it summarize your inbox, answer questions by searching the web, and carry out complex chained tasks—all while keeping your data under your control.
This guide is aimed at developers, technical educators, and curious power users comfortable with the macOS terminal. Some familiarity with Ollama is helpful but not required.
What Is OpenClaw?
OpenClaw is a middleware layer that sits between a messaging front-end and one or more AI backends. It provides:
- A messaging gateway so you can interact with your AI from any device, across multiple channels such as Telegram, Slack, and more
- An email bridge so your agent can read and send mail on your behalf
- A tool-calling framework that lets the LLM invoke external services—web search, calendar, calculators, custom APIs—and chain the results
- An allowlist-based authentication system so only you (and anyone you explicitly permit) can interact with the bot
OpenClaw is provider-agnostic and deliberately avoids cloud lock-in. Rather than tying you to a single vendor, it supports a wide range of model backends through a pluggable provider system. You can run models locally via Ollama or LM Studio for privacy-sensitive tasks, or route to cloud providers like Anthropic, OpenAI, and Gemini when you need maximum capability—and switch between them per use case through a simple config change.
Architecture Overview of OpenClaw
Before we start clicking buttons, it helps to understand the high-level architecture you are building in this article. The system is made up of five layers, each with a distinct job, and they connect in a chain—from the app you type into, down to the model that generates the answers. Table 1 summarizes the stack.
It is worth understanding what each layer contributes:
- The interface layer is how you reach your agent. In this article that is a Telegram bot, which means you can message your agent from your phone, laptop, or any other device with Telegram installed—you don't need to be sitting at the machine running OpenClaw. You could equally use Slack, Discord, or other channels; Telegram is simply the one this guide uses.
- The middleware layer is OpenClaw itself, and it is the heart of the system. When a message comes in, OpenClaw decides what to do with it: whether to answer directly, call a tool, or run a scheduled task. It routes your request to the language model, manages conversation context and sessions, and coordinates everything the other layers do. The rest of the stack plugs into it.
- The email bridge gives the agent access to your inbox. Through a Gmail OAuth connection—set up later in the article using the gogcli tool—the agent can read, search, summarize, and send email on your behalf, which is what makes tasks like a daily emailed news digest possible.
- The AI backend is where the actual intelligence comes from. Ollama serves a large language model that generates the agent's responses. It can run models locally on your machine or route to Ollama's cloud-hosted models, and OpenClaw talks to it through a single address—so you can switch models without changing anything else.
- The **tool **layer is what stops the agent from being just a chatbot. Web search and other APIs give it reach into the real world: current information, live data, and the ability to act rather than only converse. Without this layer the agent could only draw on what the model already knew at training time.
Read together, the layers form a pipeline: you send a message through the interface, OpenClaw receives it and decides how to handle it, it calls the AI backend to do the reasoning and the tool layer or email bridge to fetch information or take action, and the response travels back to you through the same interface. The sections that follow build this stack one layer at a time.
Setting Up a Fresh macOS VM with UTM
Running OpenClaw inside a virtual machine (VM) is strongly recommended for this article. It gives you a clean, reproducible environment that will not clash with other software on your host Mac, and it can be snapshotted, cloned, or thrown away without consequence. We will use UTM, the leading free virtualization app for Apple Silicon and Intel Macs.
For this article, I am using UTM on macOS. If you are using Windows, you can create a virtual machine using VirtualBox.
Why UTM?
UTM is a full-featured, open-source virtualization and emulation application for macOS. Unlike Parallels or VMware Fusion, it is completely free, it supports Apple Silicon natively through the Hypervisor framework, and it can run macOS guest VMs on Apple Silicon hardware—something neither of the commercial alternatives could do for years. Here are some of the good reasons to use UTM:
- Free and open-source (MIT license)
- Native Apple Silicon support via Apple Hypervisor
- Supports macOS, Linux, and Windows guests
- Built-in snapshot and clone support
- Available on the Mac App Store and from utm.app
Prerequisites
Before you begin, confirm that you have:
- A Mac running macOS 12 Monterey or later (host)
- At least 16 GB of RAM (32 GB recommended—the VM will claim 8 GB)
- At least 60 GB of free disk space
- A stable internet connection for downloading the macOS IPSW restore image
Apple Silicon only for macOS guests: You can only run a macOS guest VM on Apple Silicon hardware (M1, M2, M3, M4 family). On Intel Macs, use a Linux VM instead and follow the Linux installation path for OpenClaw.
Installing UTM
To install UTM, follow the steps outlined below:
- Open Safari and navigate to https://mac.getutm.app
- Click Download and save the UTM.dmg file to your Downloads folder.
- Open the DMG, drag UTM into your Applications folder, and launch it.
- If macOS asks you to confirm opening an app downloaded from the internet, click Open.
Downloading the macOS IPSW Restore Image
UTM provisions macOS VMs from an IPSW (iPhone Software Package) restore image—the same format Apple uses to restore devices. You need the IPSW that matches the macOS version you want to install in the VM.
- In UTM, click the + button in the toolbar to create a new VM.
- Choose Virtualize (not Emulate—you want near-native performance).
- Select macOS 12+ from the operating system list.
- On the next screen, click Download IPSW Automatically. UTM will fetch the latest compatible macOS restore image for your hardware and save it to your user Library folder. This file is typically 12–14 GB; allow 20–30 minutes on a fast connection.
- Once the download is completed, the IPSW path will be filled in automatically. Click Next.
Manual IPSW download: If you need a specific macOS version, download the IPSW manually from ipsw.me, choosing your Mac model and the desired version. Then click Browse in UTM and point it at the downloaded file.
Configuring the macOS VM
UTM will present a hardware configuration screen. Use these settings as shown in Table 2.
Click Save. UTM will create the VM and it will appear in the sidebar (see Figure 1). I have renamed my VM as macOS-OpenClaw. This image is in ~/Library/Containers/com.utmapp.UTM/Data/Documents/.

Installing macOS in the VM
Once your macOS VM is created, follow the steps below to install macOS on it:
- Select your new VM in the UTM sidebar and click the Play button (triangle icon). The VM will boot from the IPSW image.
- You will see the Apple logo and a progress bar. macOS will begin installing—this typically takes 10–20 minutes.
- When the installation is completed the VM reboots into the macOS Setup Assistant.
- Work through the Setup Assistant as you would on a real Mac: choose your region, connect to Wi-Fi (the VM shares your host's network by default), and create a local user account. Use a simple password—this is a dev VM, not a production machine.
- When asked about iCloud sign-in, click Set Up Later. You do not need an Apple ID in the VM for this tutorial.
- Skip all optional features (Siri, Screen Time, FileVault) for now.
- Once you reach the desktop, your macOS VM is ready.
Enable Shared Clipboard in UTM so you can paste commands from this article into the VM terminal without retyping. To do so, click on the icon as shown in Figure 2 and then select “Install Guest Tools”. This will mount a tool known as GUEST Tools on the desktop. Double-click on the spice-vdagent pkg file to install the guest tools.
Figure 2 shows the macOS VM booted up and running. Before installing OpenClaw, there is one more step: installing the Guest Tools. These enable shared-clipboard support, so you can copy commands from this article and paste them directly into the VM rather than retyping them.

Installing and Configuring OpenClaw
With the macOS VM prepared and ready to go, it is now time to install OpenClaw. Before installing OpenClaw itself, however, there are a few prerequisites:
- Install Homebrew—the macOS package manager, used to install the tools OpenClaw depends on.
- Install Ollama—the engine that serves the AI models your agent will use.
- Configure Telegram—create the bot that will act as your agent's messaging front-end.
I will go through each installation in the sections below.
Installing Homebrew
Homebrew is the package manager for macOS—it lets you install command-line software with a single command, and OpenClaw uses it to pull in the tools it depends on. Open Terminal inside the VM (Spotlight > Terminal) and paste in the following command as a single line:
/bin/bash -c "$(curl -fsSL
https://raw.githubusercontent.com/
Homebrew/install/HEAD/install.sh)"
Follow the on-screen prompts. As part of the process, Homebrew will also install the Xcode Command Line Tools if they are not already present, so the whole step can take 5–15 minutes.
Installing Ollama
Ollama is the engine that runs the AI models your agent will use. It can serve models locally on the VM or route to Ollama's cloud-hosted models, and OpenClaw talks to it through the base URL you configured during setup. Install it by pasting the following command into Terminal:
curl -fsSL https://ollama.com/install.sh | sh
Once the installation is completed, pull and run a model. This guide uses gpt-oss:120b-cloud, a cloud-hosted model with a large context window:
ollama run gpt-oss:120b-cloud
Because gpt-oss:120b-cloud is a cloud-hosted model, Ollama needs to know which account the request belongs to. The first time you run a cloud model, it prints a sign-in link that looks like this:
https://ollama.com/connect?name=Users-
Virtual-Machine.local&key=c3NoLWVkMjU1MTkg...
Copy the link and open it in a web browser inside the VM. You will be asked to sign in to (or create) a free Ollama account and confirm that this machine may connect (see Figure 3).

On that page, after signing in, click the Connect button to authorize this machine (see Figure 4).

Cloud models are convenient because they require no powerful local hardware, but the free tier has usage limits that you may reach quickly depending on how heavily you use your agent. If you need more headroom, Ollama offers paid Pro and Max plans. Note also that model availability on the free tier can change with demand—for example, kimi-k2.5:cloud is no longer available for free use, whereas gpt-oss:120b-cloud currently still is.
Configuring Telegram for OpenClaw use
Telegram will be the messaging front-end for your agent—the app you use to send it messages and receive its replies. Before OpenClaw can use Telegram, you need to create a bot: a Telegram account, controlled programmatically, that your agent operates on your behalf. Bots are created through BotFather, Telegram's official bot for managing bots.
In the Telegram app:
- Search for BotFather and open the chat with it. It is a verified account, marked with a blue checkmark—make sure you select the official one.
- Send the message /newbot to start creating a new bot.
- When prompted, give your bot a display name. This is the name shown in chats, and it can be anything you like—for example, **LWM_CL **(use your name as the prefix).
- Next, choose a username for the bot. This must be unique across Telegram and must end in bot—for example, **lwm_openclbot **(use your name as the prefix).
Once you have chosen a valid username, BotFather confirms that the bot has been created and replies with its details, as shown in Listing 1.
Make a note of this token—you will need it later, during the OpenClaw installation. Treat it like a password: do not share it or commit it to a public repository. You will paste this token into the Enter Telegram bot token prompt during the OpenClaw installation, so keep it within easy reach.
Installing OpenClaw
With the prerequisites in place, you can now install OpenClaw itself. Paste the following command into Terminal:
curl -fsSL https://openclaw.ai/install.sh |
bash
This downloads and runs the OpenClaw installer. It also detects whether Node.js—which OpenClaw depends on—is already present and installs it for you if it is not. Once the installer finishes, it launches the interactive setup, which is covered in the prompts that follow.
You will now be asked several questions to configure your OpenClaw. First, you need to confirm that you understand OpenClaw is personal-by-default—it is designed for a single user and opening it up to multiple people requires deliberate lock-down steps. Select Yes to continue:
◆ I understand this is personal-by-default
and shared/multi-user use requires
lock-down. Continue?
│ ● Yes / ○ No
Next, choose how much of the setup you want to walk through. Select QuickStart—this applies sensible local defaults and gets you running quickly; you can change any of the details later with the openclaw configure command. **Manual setup **steps through every option individually, which you only need if you want fine-grained control from the outset:
◆ Setup mode
│ ● QuickStart (recommended) (Recommended
local setup. Change details later with
openclaw configure.)
│ ○ Manual setup
Now you need to tell OpenClaw which AI provider to use. The prompt lists a few common ones—Anthropic, Google, OpenAI, and xAI (Grok)—but since this guide uses Ollama, none of these is the one you want. Select More… to open the full provider list.
◆ Model/auth provider
│ ○ Anthropic
│ ○ Google
│ ○ OpenAI
│ ○ xAI (Grok)
│ ● More…
│ ○ Skip for now
Selecting More**…** opens the full provider list. This list is long, so rather than scrolling you can start typing in the Searchfield to filter it down—type “ollama” and the list narrows immediately. Select Ollama (Cloud and local open models) and press Enter.
◆ Model/auth provider
│
│ Search:
│ ○ Anthropic
│ ○ Arcee AI
│ ○ BytePlus
...
│ ○ Moonshot AI (Kimi K2.6)
│ ○ NVIDIA
│ ● Ollama (Cloud and local open models)
│ ○ OpenAI
...
│ ○ Venice AI
│ ○ Vercel AI Gateway
...
│ ↑/↓ to select • Enter: confirm • Type: to
search
Having chosen Ollama, you now tell OpenClaw how it should reach your models. Cloud + Local is the most flexible option: it routes both cloud-hosted models (like gpt-oss:120b-cloud) and any models you have pulled locally through the same Ollama host, so you can switch between them freely later. Cloud only and Local only restrict the agent to one or the other. Select Cloud + Local and press Enter.
◆ Ollama mode
│ ● Cloud + Local (Route cloud and local
models through your Ollama host)
│ ○ Cloud only
│ ○ Local only
Next, OpenClaw asks for the address of your Ollama host. The default, http://127.0.0.1:11434, points to Ollama running locally on the same machine—which is correct for this setup, since you installed Ollama on the VM earlier. Leave it as-is and press Enter.
◆ Ollama base URL
│ http://127.0.0.1:11434
Now you choose which model the agent should use by default. Keep current** **would accept OpenClaw's fallback (ollama/gemma4), and Enter model manually lets you type a model name directly if you already know it. Since you want to pick a specific cloud model, select Browse all models and press Enter to see the full list.
◆ Default model
│ ○ Keep current (default: ollama/gemma4)
│ ○ Enter model manually
│ ● Browse all models
Browse all models opens the searchable model list. As before, you can type in the Search field to filter it. Select ollama/gpt-oss:120b-cloud—the annotation (ctx 128k · reasoning) tells you it has a 128k context window and supports reasoning, making it a capable default for general use. Press Enter to confirm.
◆ Default model
│
│ Search:
│ ○ Keep current (default: ollama/gemma4)
│ ○ Enter model manually
│ ○ ollama/gemma4
│ ○ ollama/glm-5.1:cloud
│ ● ollama/gpt-oss:120b-cloud (ctx 128k ·
reasoning)
│ ○ ollama/kimi-k2.5:cloud
│ ○ ollama/minimax-m2.7:cloud
│ ↑/↓ to select • Enter: confirm • Type:
to search
Next, OpenClaw asks which messaging channel you want to talk to your agent through. This is the front-end you'll use to send it messages from any device. OpenClaw supports many channels—Discord, Slack, WhatsApp, and more—but this guide uses Telegram. Type “telegram” in the Search field to filter the list, select Telegram (Bot API), and press Enter.
◆ Select channel (QuickStart)
│
│ Search:
│ ○ ClickClack
│ ○ Discord (Bot API)
...
│ ○ Slack (Socket Mode)
│ ○ Synology Chat (Webhook)
│ ● Telegram (Bot API)
│ ○ Tlon (Urbit)
│ ○ Twitch (Chat)
...
│ ○ WhatsApp (QR link)
│ ○ Yuanbao (元宝)
...
│ ↑/↓ to select • Enter: confirm • Type:
│ to search
Having selected Telegram, OpenClaw now needs the bot token so it can connect to your bot. This panel is just an on-screen reminder of how to obtain that token from BotFather. You already did this earlier when you configured Telegram, so you can use the token you saved then—there is no need to create a new bot.
◆ Telegram bot token ────────────────────────────────────────────╮
│ 1) Open Telegram and chat with @BotFather
│ 2) Run /newbot (or /mybots)
│ 3) Copy the token (looks like
123456:ABC...)
│ Tip: you can also set TELEGRAM_BOT_TOKEN
in your env.
│ Docs: https://docs.openclaw.ai/telegram
│ Website: https://openclaw.ai
├───────────────────────────────────────────╯
Next, OpenClaw asks how you want to supply the token and provides two options. Enter Telegram bot token (Stores the credential directly in OpenClaw config)—the simplest option, is fine for a personal setup like this one. Use external secret provider is for teams or production deployments that keep secrets in a dedicated vault. Select Enter Telegram bot token** **and press Enter.
◆ How do you want to provide this
Telegram bot token?
│ ● Enter Telegram bot token (Stores the
credential directly in OpenClaw config)
│ ○ Use external secret provider
OpenClaw now presents the input field for the token itself. Paste in the bot token you saved earlier from BotFather—the long string in the form 123456:ABC…—and press Enter.
◆ Enter Telegram bot token
│ <your_telegram_bot_token>
Next, OpenClaw asks which search provider the agent should use to look things up on the web. This is what gives the agent its real-time reach—answering current questions and fetching pages rather than relying only on the model's training data. Select Ollama Web Search: as the annotation notes, it runs through your local Ollama host and is key-free, so there is no separate API key to obtain. It does require that you are signed in to Ollama, which you did when you ran ollama run earlier (back in the Installing Ollama section). Press Enter to confirm.
◆ Search provider
│ Search:
│ ○ Brave Search
│ ○ DuckDuckGo Search (experimental)
...
│ ○ MiniMax Search
│ ● Ollama Web Search (Local Ollama host ·
requires ollama signin · key-free)
│ ○ Perplexity Search
...
│ ○ Skip for now
│ ↑/↓ to select • Enter: confirm • Type:
to search
OpenClaw now shows a summary of its skills—the optional tools the agent can call, such as file management, calendar access, or shell commands. The panel reports how many are ready to use and how many cannot yet run. In the example above, 7 skills are eligible (their requirements are already met), while 45 show missing requirements—these are skills that need additional software or credentials before they will work. Unsupported on this OS and Blocked by allowlist are both zero here.
OpenClaw then asks whether you want to configure skills now. You can safely select No for this guide—the eligible skills are enough to get started, and you can set up the rest at any time with openclaw configure. Choosing Yes would walk you through resolving the missing requirements one by one.
◆ Skills status─────────────╮
│ │
│ Eligible: 7 │
│ Missing requirements: 45 │
│ Unsupported on this OS: 0 │
│ Blocked by allowlist: 0 │
├─────────────────────────────╯
│
◆ Configure skills now? (recommended)
│ ○ Yes / ● No
Next, OpenClaw asks whether to enable any hooks—small automatic actions that run at set points in the agent's lifecycle, such as loading instructions at startup (boot-md), logging commands (command-logger), or persisting memory between sessions (session-memory). For this first setup you do not need any of these, so leave Skip for now checked and press Enter. Hooks can be enabled later once you are familiar with how the agent behaves.
◆ Enable hooks?
│ ◼ Skip for now
│ ◻ 🚀 boot-md
│ ◻ 📎 bootstrap-extra-files
│ ◻ 📝 command-logger
│ ◻ 🧹 compaction-notifier
│ ◻ 💾 session-memory
“How do you want to hatch your agent?” is the final setup question. “Hatching” is OpenClaw's term for starting your agent for the first time—a nod to the project's lobster theme. Hatch in Terminal launches the agent right away in the Terminal User Interface (TUI), the terminal-based console described earlier in this article. Hatch in Browser opens it in a web interface instead, and Hatch later finishes setup without starting the agent. Select Hatch in Terminal and press Enter.
◆ How do you want to hatch your agent?
│ ● Hatch in Terminal (recommended)
│ ○ Hatch in Browser
│ ○ Hatch later
OpenClaw will now start, and the TUI will appear (see Figure 5).

OpenClaw will now be installed in ~/.local/bin/openclaw.
Configuring OpenClaw
Now that OpenClaw is installed, you are ready to configure it. This section covers:
- The OpenClaw Gateway—the core service that orchestrates everything
- The OpenClaw TUI—the terminal interface for talking to your agent
- The OpenClaw Dashboard—the web-based interface for monitoring and management
- How to make changes to your OpenClaw setup after installation
- Connecting Telegram to OpenClaw
- Connecting a Gmail account to OpenClaw via gogcli
- Working with hooks—setting up event-driven automations that let your agent react on its own, such as notifying you when a new email arrives
OpenClaw Gateway
The OpenClaw gateway is essentially the brain and backbone of the whole system. It's the always-on background process that runs on your machine (or VPS) and manages everything. Specifically, it handles:
- Channel connections—keeps your WhatsApp, Telegram, Slack, etc., connections alive and routes incoming messages to your agent
- Model routing—forwards your messages to whichever LLM you've configured (Kimi, Claude, llama3.2 etc.) and streams responses back
- Memory—maintains conversation history and context across sessions
- Client connections—all the ways you talk to OpenClaw (TUI, web dashboard, mobile app) connect to the gateway over WebSocket, rather than directly to the AI
- Tool execution—when your agent runs a tool (web search, shell command, file access), the gateway coordinates that
Because the gateway is a background service, you control it with four commands:
openclaw gateway start
openclaw gateway stop
openclaw gateway status
openclaw gateway restart
Use start and stop to bring the service up or down, use status to check whether it is healthy, and restart after any configuration change. Note that restart is its own command—you should not substitute it by running stop followed by start.
You can also run openclaw status to get an at-a-glance overview of your whole OpenClaw setup (see Figure 6)—including the active agent, connected channels, and overall health—not just the gateway service on its own.

Using the OpenClaw TUI
The TUI is OpenClaw's interactive terminal console—the most direct way to talk to your agent. If you selected Hatch in Terminal at the end of setup, the TUI opens automatically; you can also bring it up at any time by running openclaw from the terminal. It lets you chat with the agent, watch it call tools in real time, and see exactly how much of the model's context window is in use, all without leaving the terminal or connecting a messaging channel. Because it needs no additional setup, the TUI is the best place to confirm that your model, search provider, and tools are all working before you move on to using the agent through Telegram.
Figure 7 shows the OpenClaw TUI and identifies its main elements.

The two status lines at the bottom of the TUI tell you which configuration the agent is running under and how much of the model's working memory is in use. Each element is explained below:
- agent main means you're running the agent configuration named “main”—in OpenClaw, agents are named configurations bundling together a model, system prompt, tool set, and other settings. “main” is just the default one; you can define others (e.g., a coding agent, a research agent) and switch between them.
- session main is the conversation session you're in. Sessions are separate conversation threads, each with its own message history and context window.
- Context window usage—The 131k is the total context window size of the model you're running; ollama/gpt-oss:120b-cloud has a 131,072-token limit. The 12k is how much of that window is currently filled by your conversation: the system prompt, your messages, the agent's replies, any tool results (like that weather lookup), and so on. The (9%) is simply that ratio expressed as a percentage. As you add to the conversation, the context keeps growing until you hit the limit—at which point OpenClaw starts truncating or compacting the oldest messages. You can manually reset a conversation by typing /reset.
Using the OpenClaw Dashboard
Alongside the TUI, OpenClaw provides a web-based dashboard—officially called the Control UI—for managing and monitoring your agent in a browser. The dashboard is served by the gateway itself on its port (18789 by default), so no separate installation is needed; it ships with OpenClaw.
Where the CLI and Telegram are for using the agent, the dashboard is for overseeing it. In practical terms, it lets you:
- Chat with the agent directly in the browser, as an alternative to the TUI or Telegram
- View and manage agents—change the model, system prompt, and other settings, with changes taking effect without restarting the gateway
- See which channels (Telegram, Slack, and so on) are connected and their status
- Enable or disable skills per agent, and configure API keys without editing files by hand
- Review past sessions and a live tail (real-time streaming view) of the gateway and agent logs
- Monitor scheduled (cron) tasks—their schedules, and their last and next runs
- Inspect diagnostic and debugging information when something goes wrong
To open the dashboard, make sure the gateway is running and then type the following command in Terminal:
openclaw dashboard
This opens your browser at the gateway's address. The first time you connect, the dashboard asks for your gateway token to authenticate; after that, you are in. Figure 8 shows the OpenClaw Dashboard.

Making Changes to OpenClaw Setup
The choices you made during installation are not permanent—you can revisit them at any time. There are two ways to do this, depending on how much you want to change.
To step through the full guided setup again—the same sequence of prompts you saw when OpenClaw was first installed—run:
openclaw onboard
This is useful when you want to reconfigure several things at once, such as switching the model provider, changing channels, or re-entering credentials.
For a single, targeted change you do not need the full wizard. The openclaw config commands let you read and set individual settings directly. For example, to change the default model the agent uses, you would set the relevant configuration value and then restart the gateway for it to take effect.
Figure 9 shows the openclaw config command in action. The command launches OpenClaw's configuration wizard. As the figure shows, it first detects your existing configuration and displays the current settings—workspace, model, and gateway options—then walks you back through the same prompts you saw during installation. Step through them and change whatever you need; to switch the model the agent uses, for example, simply select a different one when the model prompt appears.

Tip: Once you have changed a model used in OpenClaw, be sure to restart the OpenClaw gateway using **openclaw gateway restart
**Connecting Telegram to OpenClaw
Earlier, you added the Telegram bot token to OpenClaw during setup. That token lets OpenClaw send and receive messages through your bot, but it does not yet decide who is allowed to talk to the bot. OpenClaw is personal-by-default: even though your bot exists on Telegram, anyone who finds it and messages it will simply be ignored until you explicitly approve them. This pairing step is what links your own Telegram account to the agent.
Open Telegram, search for the bot username you created with BotFather (for example, lwm_openclbot), and start a chat with it. Send it any message—a simple “hi” is enough. Because your account has not been paired yet, OpenClaw will reply with a short pairing code (see Figure 10) together with your Chat ID. Record it down—you will need it later.

Back in the OpenClaw terminal on the VM, run the pairing command, replacing the placeholder with the code your bot sent you:
openclaw pairing approve telegram \
<pairing_code>
Once the command succeeds, your Telegram account is paired with the agent. Send the bot another message—for example, "How's the weather in Singapore today?"—and it should now respond as the agent, complete with tool use and the same context tracking you saw in the TUI. From this point on you can talk to your OpenClaw agent from any device that has Telegram installed.
Connecting Gmail to OpenClaw
To give your agent access to email, OpenClaw uses a separate command-line tool called gogcli (the binary is named gog). It is a fast, script-friendly CLI for Google services—Gmail, Calendar, Drive, Docs, Sheets, Contacts, and more—with JSON-first output, support for multiple accounts, and least-privilege authentication built in. It is written in Go and, like OpenClaw, comes from Peter Steinberger. Because gog runs on the same machine as your agent, OpenClaw can call it as a tool to read, search, and send mail on your behalf.
Install it with Homebrew:
brew install steipete/tap/gogcli
Installing gog gives your agent the tool for working with Gmail, but not yet the permission. Before OpenClaw can read your inbox or send mail on your behalf, you need to authorize gog against a specific Google account. Google requires this to go through OAuth: you create a project in Google Cloud, register an “app” (your local gog tool), and authorize it against the Gmail account you want to access. This is a one-time setup, and the steps below walk through it.
1. Create the Google Cloud Project
Go to https://console.cloud.google.com/ and log in to your new Gmail account. Agree to the Terms of Service if prompted. Click Select a project, then New project. Name it OpenClaw. The project is just a container that holds your API settings and credentials—nothing is billed or charged for the Gmail API at normal usage levels.
2. Enable the Gmail API
The project starts with no APIs switched on, so Gmail access must be enabled explicitly first—before you authenticate—otherwise the connection will fail.
Go to APIs & Services** | **Enable APIs & services, click + Enable APIs and services, find and select the Gmail API, then click Enable.
3. Configure the OAuth Consent Screen
The consent screen is what you'll see in the browser later when you grant access. Google requires it to be set up before it will issue credentials.
Go to APIs & Services | Credentials, click + Create credentials | OAuth client ID, then Configure consent screen and Get started.
Fill in the app details and click Next. For the audience type, select External—this simply means the app isn't restricted to a Google Workspace organization; it does not make anything public.
Fill in your contact information, check I agree, and click Continue, then Create.
4. Create the OAuth Client (Desktop app)
Click Create OAuth client and select Desktop app as the type. This is the right choice because gog is a command-line tool running on your own machine, not a web service.
Click Create. Google will show you a Client ID and Client secret—copy both, or use the Download** **JSON button (recommended, as it avoids transcription errors and includes the correct project ID).
5. Add Yourself as a Test User
While the project is in Testing mode, only accounts you explicitly list are allowed to authorize the app.
Go to APIs & Services | OAuth consent screen, click Audience, then Add users. Enter your email address and click Save.
NOTE: In testing mode, the access token expires after 7 days, after which you'll need to re-run the auth step. That's fine for personal use; publishing the app for verification removes the limit but isn't necessary here.
6. Create the Credentials File
gog needs the OAuth client details on disk to start the login flow. Create a file in your home directory named client_secret.json. If you downloaded the JSON in step 4, you can just use that file directly. Otherwise, populate it with:
{
"installed": {
"client_id": "<client_id>",
"project_id": "<project_id>",
"auth_uri":
"https://accounts.google.com/o/oauth2/auth",
"token_uri":
"https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url":
"https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "<client_secret>",
"redirect_uris": ["http://localhost"]
}
}
Replace <client_id> and <client_secret> with the values from step 4. For <project_id>, use the actual project ID Google assigned (e.g., openclaw-461203), not the display name—you'll find it in the Cloud Console or in the downloaded JSON.
7. Authenticate
In Terminal, run:
gog auth add xxxxxxx@gmail.com
Replace the email with the account you want OpenClaw to access. This kicks off the OAuth flow—gog opens your browser so you can grant permission interactively.
In the browser:
- Click the email address you're authorizing.
- If you see a "Google hasn't verified this app" warning, click Advanced, then Go to OpenClaw (unsafe). This warning is expected for a personal testing-mode app and is safe here because you created the app.
- Click Continue through the remaining prompts.
- Check Select All to grant the requested permissions, then click Continue at the bottom of the page.
Once complete, the browser confirms success and gog stores the token locally. Your Gmail account is now connected—you can ask the agent to summarize your inbox, check unread messages, draft and send mail, and more, from either the TUI or Telegram.
Automating Your Agent with Hooks
In OpenClaw, hooks are event-driven triggers that make your agent react automatically to something happening—without you having to ask it manually. Think of it as “if this happens, do that” automation.
Examples of hook triggers:
- A new email arrives in Gmail
- A file changes on your system
- A webhook is received from an external service
- A scheduled time is reached (though that's more cron)
What hooks can do when triggered:
- Summarize the email and send you a Telegram notification
- Alert you about an urgent message
- Process the incoming data and take action
- Forward information to another service
Let's try adding a Gmail hook now. In the OpenClaw TUI, type the following request in plain English (see Figure 11):
“Add a Gmail hook that notifies me on Telegram when I receive a new email.”
The agent will interpret your request and begin setting up the scheduled job. As part of this, it will ask you for two pieces of information: your Telegram Bot token and your Chat ID, both of which you obtained earlier in the Telegram setup section. Once you provide these, the agent completes the setup and confirms that the hook is in place.

You can view the list of scheduled cron jobs using the following command in Terminal:
openclaw cron list
You will now be notified through Telegram whenever you receive a new email on your Gmail account.
Things to Try with Your OpenClaw Agent
With Telegram, Gmail, and web search all connected, your agent is now more than a chatbot—it can gather information, act on your accounts, and run tasks on a schedule. The prompts below are good starting points for exploring what it can do. Each can be sent from the TUI or from Telegram; the agent will decide which tools to use on its own.
Comparing Products
Ask the agent to research and weigh up two options for you—it will search the web for current specifications and pricing, then return a structured comparison rather than a raw list of links. In the OpenClaw TUI, type:
"Compare the MacBook Pro M4 Max and the Mac Studio M4 Ultra for machine learning workloads. Focus on unified memory bandwidth, GPU cores, and price."
Figure 12 shows the response by OpenClaw.

Quick Fact-Check
For questions whose answers change over time, the agent will reach for web search rather than relying on the model's training data, so you get a current figure instead of a stale one. In the OpenClaw TUI, type:
"What is the current SORA (Singapore Overnight Rate Average)?"
Behind the scenes, the agent recognizes that this is a question about current data and calls the Ollama Web Search provider you configured during setup, rather than answering from the model's training data. It retrieves the latest published rate, and its reply will typically cite the source and the date the figure applies to—useful for confirming the answer is genuinely current. This is the same web-search capability the agent draws on for any time-sensitive question, from exchange rates to news headlines.
Track a Topic Over Time
Because each session keeps its own context, you can return to the same conversation over several days and have the agent build on what it already found. Start a thread on a subject you want to follow. In the OpenClaw TUI, type:
“Search for the latest news on large language model benchmark results. Give me five key developments from the past week.”
Figure 13 shows the agent's response. Later, you can come back to this same session and ask a follow-up such as "What has changed since we last spoke?"—and because the earlier exchange is still in context, the agent can compare against what it reported before rather than starting from scratch.

Productivity and Scheduling
The agent can also run tasks on a schedule rather than only when you ask. Combined with the Gmail connection, this turns it into a small automation engine—it can gather information at a set time each day and deliver the result straight to your inbox. In the OpenClaw TUI, type (see Figure 14):
"Every morning at 8am, search the web for any press releases or announcements from Anthropic, OpenAI, and Google DeepMind in the past week. Summarize the key announcements in bullet points, one section per company, and email the summary to xxxxxxxx@gmail.com."
OpenClaw registers this as a scheduled cron job. Each morning it will run the web search, summarize the results, and use gog to send the email—all without any further input from you.

You can also get OpenClaw to send you a sample email:
“Send me a sample now!”
Figure 15 shows a sample I received on my email.

Summary
In this article you built a complete personal AI agent platform from the ground up. You created a clean, disposable macOS environment with UTM, installed the supporting tools—Homebrew and Ollama—and then set up OpenClaw itself, the middleware that ties everything together. You connected three things to it: Telegram as the messaging interface you can reach from any device, Ollama as the model backend, and Gmail (through gogcli) as an email bridge the agent can act on. Along the way you also saw how OpenClaw handles sessions, context windows, and the pairing model that keeps the bot personal-by-default.
The result is an agent that runs entirely on hardware you control. It can answer questions with live web search, summarize articles and your inbox, compare options, and carry out scheduled tasks—without a monthly subscription to a cloud AI provider and without your data leaving your own VM. Because OpenClaw is provider-agnostic, the same setup will happily route to Anthropic, OpenAI, or Gemini models when a task needs more capability than a local model can offer; switching is a single config change.
From here, there is plenty of room to extend what you have built. You could add more channels such as Slack or Discord, enable additional skills and hooks during configuration, connect other Google services through gog (Calendar, Drive, and Tasks all work the same way), or take a VM snapshot so you can experiment freely and roll back if anything breaks. The platform you have set up is a foundation—how far you take it is up to you.
<a id="table1"Table 1. The stack you'll build in this article.
| Layer | Component | Role |
|---|---|---|
| Interface | Telegram Bot | You chat here from any device |
| Middleware | OpenClaw Server | Orchestrates tools and LLM calls |
| Email Bridge | Gmail OAuth | Read / send email on your behalf |
| AI Backend | Ollama | Serves the LLM locally or via cloud |
| Tool Layer | Web search, APIs | Gives the agent real-world reach |
| Setting | Recommended Value |
|---|---|
| CPU Cores | 4 cores (increase to 6 if your Mac has 10+ cores) |
| Memory (RAM) | 8192 MB (8 GB) |
| Storage | 60 GB (use 80 GB if space permits) |
| Network | Shared Network (NAT)—default |
| Display | Full Resolution Retina—optional |
| Hardware OpenGL | Enabled |
Listing 0: 1. Reply from BotFather
Done! Congratulations on your new bot. You will
find it at t.me/lwm_openclbot. You can now add a
description, about section and profile picture
for your bot, see /help for a list of commands.
By the way, when you've finished creating your
cool bot, ping our Bot Support if you want a
better username for it. Just make sure the bot
is fully operational before you do this.
Use this token to access the HTTP API:
8xxxxxxx25:Axx6BsxxxxxONxxRxxxxxRCLoNxxxxxNxbo
Keep your token secure and store it safely, it
can be used by anyone to control your bot.



