March 23, 2026

OpenClaw – A Complete Clean Reinstall of OpenClaw and Telegram Bot Reset Guide

A Complete Clean Reinstall of OpenClaw and Telegram Bot Reset Guide

First, remove OpenClaw completely together with its service, state directory, and workspace, then delete the old Telegram bot, and finally reinstall everything and create a brand-new bot.

OpenClaw already provides a built-in uninstall flow. The openclaw uninstall command removes the gateway service and local data. If you want the removal to be as thorough as possible, the official documentation also recommends deleting the state directory, the workspace, and removing the CLI itself according to the way you originally installed it.

1. Completely Remove “OpenClaw”

The most recommended way to do a clean reinstall

Start with:

openclaw uninstall --all --yes --non-interactive

This is the official non-interactive full uninstall command. It removes the service, state, workspace, and related local content. However, whether the CLI executable itself is still present depends on how you originally installed it.

Then remove the CLI as well:

npm rm -g openclaw

If you installed it with pnpm or bun instead of npm, use one of these instead:

pnpm remove -g openclaw
# or
bun remove -g openclaw

The OpenClaw documentation is very clear on this point: the standard installation from install.sh or install.ps1 uses a global npm installation by default, so the corresponding uninstall command is npm rm -g openclaw.

If you want to manually verify that everything is gone

You can also check and remove these paths manually:


echo "$HOME"
echo "$OPENCLAW_STATE_DIR"
Common result:
HOME prints something like /Users/yourname or /home/yourname
OPENCLAW_STATE_DIR is blank
That is normal. In that case, the command will delete:
~/.openclaw
So you can also run this directly:
rm -rf ~/.openclaw 

rm -rf "${OPENCLAW_STATE_DIR:-$HOME/.openclaw}" rm -rf ~/.openclaw/workspace 

According to the OpenClaw documentation, the default state directory is ~/.openclaw, and the default workspace is ~/.openclaw/workspace. Sessions, configuration, credentials, logs, and other data are also stored under this state directory.

If you previously used profiles, remove those profile directories too:

rm -rf ~/.openclaw-*

The official documentation states that profiles are stored by default under paths like ~/.openclaw-<profile>.

If you are on macOS, make sure no background service is left behind

If the openclaw command is already gone but the background service is still running, the official manual cleanup commands for launchd are:

UID means your user ID on macOS or Linux.

echo $UID

launchctl bootout gui/$UID/ai.openclaw.gateway
rm -f ~/Library/LaunchAgents/ai.openclaw.gateway.plist

These are the default macOS service label and plist location.

If you installed the Mac app, you can also remove it with:

rm -rf /Applications/OpenClaw.app

This is also listed separately in the official uninstall steps.

If you originally ran it from a git clone

In that case, first uninstall the service, then delete the repository directory directly. The official guidance for a source checkout is: uninstall the service first, then remove the repo, and then remove the state directory and workspace.

2. Delete the Old Telegram Bot and Create a New One

If you suspect the old bot is problematic, that is a reasonable approach. Telegram’s official BotFather supports the following commands:

  • /newbot: create a new bot
    • name -> username
    • /token -> username
  • /token: generate a new token for an existing bot
  • /deletebot: permanently delete the old bot; the username will be released, and the action is irreversible
    • username -> Yes, I am totally sure.

Steps to create a new bot

Go to @BotFather in Telegram and run:

/newbot

BotFather will ask for two things:

  • Bot name: the display name, which can be anything
  • Bot username: must be 5–32 characters, can only contain Latin letters, numbers, and underscores, and must end in bot, for example my_openclaw_bot

The username cannot be changed later. Once creation succeeds, BotFather will give you a token.

If you want to completely retire the old bot, run this in BotFather:

/deletebot

If you only suspect the token was leaked but want to keep the same bot, run:

/token

This will generate a new token.


3. Reinstall a Fresh Copy of OpenClaw

The officially recommended installation command is:

curl -fsSL https://openclaw.ai/install.sh | bash

This installer automatically checks your system, installs the required Node version, and installs OpenClaw. Node 24 is the recommended version, while Node 22.16+ is also supported.

After installation, the onboarding flow recommended in the official FAQ is:

openclaw onboard --install-daemon

This installs the daemon or service as part of the setup.

DuckDuckGo Search.

The official OpenClaw documentation clearly states that DuckDuckGo Search does not require an API key or an account. However, it also notes that this is an experimental, unofficial integration, so it may occasionally break due to page changes or anti-bot protections. The official recommendation is to prefer an API-backed provider such as Brave for production use.

Skip web search for now and configure it later.

The OpenClaw onboarding documentation states that the web search step can be skipped, and you can configure it later with:

openclaw configure --section web

4. Connect the New Bot Back to OpenClaw

The official OpenClaw configuration method for Telegram is to put the token into the configuration or environment variables, then start the gateway. Telegram does not use openclaw channels login telegram.

The simplest base configuration looks like this:

{
"channels": {
"telegram": {
"enabled": true,
"botToken": "123456:ABC...",
"dmPolicy": "pairing",
"groups": {
"*": { "requireMention": true }
}
}
}
}

This is the minimal working example from the official documentation.

You can also do it through the CLI:

openclaw channels add --channel telegram --account default --name "My Telegram Bot" --token 'your-new-token'

The OpenClaw CLI reference includes an example using channels add --channel telegram ... --token ....

Then start the gateway and pair the bot:

bot -> /start -> pairing code

openclaw gateway
openclaw pairing list telegram
openclaw pairing approve telegram <pairing-code>

The default Telegram DM policy is pairing. After the first private chat, you need to approve the pairing code, and the code expires after 1 hour.

5. If You Want the Bot to Work in Groups, Do These Too

If you want the new bot to work properly in group chats, both Telegram’s official guidance and the OpenClaw documentation highlight two important things:

Allow the bot to be added to groups

In BotFather, enable:

/setjoingroups

choose a bot -> enable

Make sure the bot can see group messages

Bots have Privacy Mode enabled by default. If you want the bot to see ordinary group messages, you have two options:

  • turn off privacy mode with /setprivacy -> Disable, or
  • make the bot a group administrator directly (*)

After changing privacy mode, remove the bot from the group and add it back again. Telegram only applies the new setting after the bot is re-added.

If you only want the bot to respond when someone mentions @bot, you can keep Privacy Mode enabled and set requireMention: true in the configuration. That is also the default example shown in the OpenClaw documentation.

vi ~/.openclaw/openclaw.json

@userinfobot -> /start

ID: 12345

{

  "commands": {

    "allowFrom": {

      "telegram": ["user id", "user id 2"]

    }

  },

  "channels": {

    "telegram": {

      "name": "My Telegram Bot",

      "enabled": true,

      "dmPolicy": "allowlist",

      "allowFrom": ["user id", "user id 2"],

      "botToken": "BotFather token",

      "groupPolicy": "open",

      "groupAllowFrom": ["user id", "user id 2"],

      "groups": {

        "*": {

          "requireMention": false

        }

      },

      "streaming": "partial"

    }

  }

}

 

 

No comments:

Post a Comment