Skip to main content
Tutorial 12 min read

Install OpenClaw: Control Your PC via WhatsApp & Claude

Step-by-step guide to install OpenClaw (Clawdbot/Moltbot) - connect Claude AI to your PC via WhatsApp for file management and shell commands.

Originally published:

YouTube by Emmanuel Adegor | Ai Automation

Introduction

OpenClaw (formerly known as Clawdbot or Moltbot) is a self-hosted AI agent that connects Claude AI directly to your computer through WhatsApp. This powerful integration lets you control your Mac or PC, search files, execute shell commands, and leverage Claude's capabilities from anywhere using just your phone. Unlike cloud-based AI assistants with limited access to your system, OpenClaw runs locally and provides direct system integration while maintaining your privacy and control.

This tutorial walks you through the complete setup process for OpenClaw, from initial installation to advanced configuration. By the end, you'll have a fully functional AI assistant accessible through WhatsApp that can help with file management, code execution, and system automation.

Learning Objectives

By completing this tutorial, you will:

  • Understand OpenClaw's architecture and how it connects WhatsApp to Claude AI
  • Successfully install and configure OpenClaw on your Mac or PC
  • Set up WhatsApp integration for remote AI control
  • Execute basic file operations and shell commands through the AI agent
  • Configure security settings to protect your system
  • Troubleshoot common installation and connectivity issues

Prerequisites

Before starting the installation, ensure you have the following:

Hardware and Software Requirements

  • Operating System: macOS 10.15+ or Windows 10+ (Linux also supported with minor modifications)
  • RAM: Minimum 4GB, 8GB recommended for smooth operation
  • Storage: At least 2GB free disk space
  • Internet Connection: Stable broadband for API calls and WhatsApp connectivity
  • WhatsApp Account: Active WhatsApp on your mobile device

Required Accounts and API Keys

  • Anthropic API Key: Sign up at console.anthropic.com for Claude API access (free tier available)
  • WhatsApp Business API: Or use a WhatsApp Web-based connector (detailed below)
  • GitHub Account: For accessing the OpenClaw repository

Technical Knowledge

  • Basic command-line navigation and file system understanding
  • Familiarity with environment variables and configuration files
  • Basic understanding of API authentication concepts

Step 1: Setting Up Your Development Environment

OpenClaw requires Node.js and npm to run. Start by ensuring your development environment is properly configured.

Install Node.js and npm

Download and install Node.js version 16 or later from nodejs.org. The installation includes npm (Node Package Manager) automatically. Verify successful installation by running:

node --version
npm --version

Both commands should return version numbers. If you see errors, restart your terminal or add Node.js to your system PATH manually.

Install Git

Download Git from git-scm.com if not already installed. Verify with:

git --version

Git is essential for cloning the OpenClaw repository and managing updates.

Step 2: Obtaining Your Claude API Key

OpenClaw uses Anthropic's Claude API as its intelligence engine. Setting up API access is straightforward but requires careful handling of credentials.

Create an Anthropic Account

Navigate to console.anthropic.com and sign up for a new account. Anthropic offers free tier access with sufficient credits for testing OpenClaw's capabilities. After email verification, you'll access the API console.

Generate Your API Key

In the Anthropic Console, navigate to the API Keys section and click "Create Key." Name it "OpenClaw" for easy identification. Copy the generated key immediately—it will only display once. Store it securely in a password manager or encrypted note.

Step 3: Cloning and Installing OpenClaw

Now that prerequisites are ready, let's install OpenClaw itself.

Clone the Repository

Open your terminal and navigate to your preferred projects directory. Clone the OpenClaw repository:

git clone https://github.com/openclaw/openclaw.git
cd openclaw

If the repository name or location has changed (OpenClaw was recently rebranded from Clawdbot/Moltbot), check the official documentation or GitHub organization page for the current repository URL.

Install Dependencies

Inside the openclaw directory, install all required npm packages:

npm install

This process may take several minutes depending on your connection speed. npm will download all libraries OpenClaw needs, including WhatsApp client libraries, Claude API wrappers, and file system utilities.

Project Structure Overview

Familiarize yourself with key files and directories:

  • config/: Configuration files for API keys and system settings
  • src/: Core application source code
  • handlers/: Command handlers for different AI operations
  • .env.example: Template for environment variables

Step 4: Configuring Environment Variables

OpenClaw uses environment variables to store sensitive credentials securely.

Create Your Configuration File

Copy the example environment file:

cp .env.example .env

Open .env in your preferred text editor (VS Code, Sublime, nano, etc.). You'll see several placeholder values that need configuration.

Set Essential Variables

Configure these critical settings:

ANTHROPIC_API_KEY=your_claude_api_key_here
WHATSAPP_SESSION_NAME=openclaw_session
SYSTEM_ACCESS_LEVEL=restricted
ALLOWED_COMMANDS=ls,cat,grep,find

Replace your_claude_api_key_here with the API key from Step 2. The ALLOWED_COMMANDS variable controls which shell commands OpenClaw can execute—start restrictive and expand as you understand security implications.

Optional Configuration

Additional variables customize behavior:

  • MAX_FILE_SIZE: Limits file operations to prevent memory issues (default: 10MB)
  • LOG_LEVEL: Controls verbosity (debug, info, warn, error)
  • RESPONSE_TIMEOUT: Maximum seconds to wait for Claude's response (default: 30)

Step 5: Setting Up WhatsApp Integration

OpenClaw connects to WhatsApp using whatsapp-web.js, which emulates WhatsApp Web functionality.

First-Time Connection

Start OpenClaw for the first time:

npm start

The application will initialize and display a QR code in your terminal. This code authenticates OpenClaw with your WhatsApp account.

Scan the QR Code

On your phone, open WhatsApp and navigate to Settings > Linked Devices > Link a Device. Scan the QR code displayed in your terminal. Within seconds, OpenClaw will confirm successful connection.

The session data is saved locally, so you won't need to scan again unless you explicitly log out or clear session files.

Verify Connection

Send a message to your own WhatsApp number (saved as "Me" or your contact name). Try a simple command:

/help

OpenClaw should respond with available commands and usage instructions. If you receive a response, your setup is working correctly.

Step 6: Testing Basic Functionality

Start with simple commands to understand OpenClaw's capabilities and build confidence before attempting complex operations.

File System Navigation

List files in your home directory:

/ls ~

OpenClaw executes the ls command and returns results via WhatsApp. The tilde (~) represents your home directory. Try navigating to specific folders:

/ls ~/Documents
/ls ~/Downloads

File Content Reading

View text file contents:

/cat ~/Documents/notes.txt

The cat command displays file contents. For large files, OpenClaw may truncate output or provide summaries to avoid overwhelming WhatsApp message limits.

Natural Language Queries

OpenClaw's true power emerges with natural language processing. Instead of exact commands, describe what you want:

Find all Python files in my Documents folder modified in the last week

Claude interprets your intent, constructs appropriate shell commands, executes them (if allowed), and presents results conversationally. This natural interface makes system administration accessible without memorizing complex command syntax.

Step 7: Advanced Configuration and Security

After confirming basic functionality, implement security measures to protect your system from unintended actions.

Command Whitelisting

The ALLOWED_COMMANDS variable in .env restricts executable commands. Expand this list thoughtfully:

ALLOWED_COMMANDS=ls,cat,grep,find,pwd,echo,head,tail,wc

Never whitelist destructive commands like rm, sudo, or chmod without additional safeguards. Consider implementing a confirmation system for high-risk operations.

Directory Access Restrictions

Configure ALLOWED_PATHS to limit file system access:

ALLOWED_PATHS=/Users/yourusername/Documents,/Users/yourusername/Downloads

This prevents OpenClaw from accessing system directories, configuration files, or sensitive data outside designated folders.

Rate Limiting

Implement request rate limiting to prevent API quota exhaustion:

MAX_REQUESTS_PER_HOUR=50
COOLDOWN_SECONDS=2

These settings prevent accidental infinite loops or excessive API charges while maintaining responsive performance for legitimate use.

Step 8: Multi-User Setup (Optional)

OpenClaw supports multi-user scenarios, allowing multiple people to interact with the same agent in group chats or through individual conversations.

Adding OpenClaw to Group Chats

Create a WhatsApp group and add your OpenClaw-connected number as a participant. Configure group settings in your .env file:

ALLOW_GROUP_CHATS=true
GROUP_COMMAND_PREFIX=@claw

In groups, prefix commands with @claw to avoid triggering on every message. For example:

@claw what's the weather in San Francisco?

User Permissions

Implement whitelist-based permissions to control who can issue commands:

AUTHORIZED_NUMBERS=+1234567890,+0987654321

Only listed phone numbers can execute OpenClaw commands, preventing unauthorized access if someone gains access to your WhatsApp groups.

Troubleshooting Common Issues

Even with careful setup, you may encounter issues. Here are solutions to frequent problems:

QR Code Won't Display

If the QR code doesn't appear in your terminal:

  • Ensure your terminal supports Unicode characters (try iTerm2 on Mac, Windows Terminal on Windows)
  • Check that port 3000 isn't blocked by firewall or used by another application
  • Verify Node.js installation and dependency installation completed successfully
  • Try running with npm start -- --verbose to see detailed logs

"API Key Invalid" Errors

If Claude API calls fail:

  • Verify your API key is correctly copied without extra spaces or line breaks
  • Check that your Anthropic account has available credits
  • Confirm the API key has appropriate permissions in the Anthropic Console
  • Test the key directly using curl to isolate whether the issue is with OpenClaw or the API itself

Commands Time Out

If commands consistently timeout:

  • Increase RESPONSE_TIMEOUT in .env for complex queries
  • Check your internet connection stability
  • Verify Claude API status at status.anthropic.com
  • Reduce command complexity—break large tasks into smaller operations

WhatsApp Disconnects Frequently

Connection instability may indicate:

  • Network issues—ensure stable internet on both phone and computer
  • Session file corruption—delete the .wwebjs_auth folder and re-authenticate
  • Multiple WhatsApp Web sessions—WhatsApp limits concurrent connections
  • Phone battery optimization killing WhatsApp background processes—adjust settings

Permission Denied Errors

If file operations fail with permission errors:

  • Verify the user running OpenClaw has read/write access to target directories
  • Check ALLOWED_PATHS includes the directories you're accessing
  • On macOS, grant Terminal full disk access in System Preferences > Security & Privacy
  • Never run OpenClaw with sudo—instead, adjust file permissions appropriately

Best Practices

Follow these guidelines to maximize OpenClaw's utility while maintaining system security and stability.

Security First

Always prioritize security over convenience:

  • Start with minimal command whitelists and expand gradually based on actual needs
  • Regularly rotate API keys and session tokens
  • Never share your OpenClaw-connected WhatsApp QR code
  • Implement logging to audit all commands executed through OpenClaw
  • Use separate WhatsApp accounts for OpenClaw rather than your primary personal number

Resource Management

Optimize performance and control costs:

  • Set appropriate context window limits to avoid excessive token usage
  • Implement caching for frequently requested file contents
  • Monitor Anthropic API usage through their console dashboard
  • Configure automatic shutdowns during inactive periods to save resources

Backup and Recovery

Protect against data loss and configuration issues:

  • Version control your .env file (encrypted) or maintain secure backups
  • Document custom configurations and command aliases
  • Regularly backup WhatsApp session data from .wwebjs_auth
  • Test restoration procedures before you need them

Workflow Integration

Maximize productivity by integrating OpenClaw into daily routines:

  • Create custom commands for frequently performed tasks
  • Use ai-automation techniques to chain OpenClaw with other tools
  • Document useful command patterns for team members in multi-user setups
  • Establish naming conventions for files and folders that work well with natural language queries

Advanced Use Cases

Once comfortable with basics, explore advanced scenarios that showcase OpenClaw's versatility.

Automated File Management

Set up recurring tasks through conversational commands:

Every day at 6pm, find log files older than 7 days in ~/logs and compress them

While OpenClaw doesn't have built-in scheduling, Claude can help you create appropriate cron jobs or scheduled tasks based on natural language descriptions.

Development Workflow Assistance

Use OpenClaw as a development assistant:

  • Search codebases for specific functions or patterns
  • Generate boilerplate code snippets
  • Execute test suites and summarize results
  • Monitor build processes and report completion status

Remote System Monitoring

Check system status from anywhere:

What's my disk usage?
Show me CPU temperature
List running processes using more than 500MB RAM

OpenClaw translates these queries into appropriate system commands and presents results in readable format.

Group Collaboration

In group chat scenarios, OpenClaw becomes a shared team assistant capable of:

  • Providing instant code reviews and suggestions
  • Searching shared documentation repositories
  • Generating project status reports from file system analysis
  • Facilitating pair programming through conversational guidance

Updating and Maintaining OpenClaw

Keep your installation current to benefit from bug fixes, new features, and security patches.

Checking for Updates

Navigate to your OpenClaw directory and check for updates:

git fetch origin
git status

If updates are available, review the changelog before applying to understand breaking changes.

Applying Updates

Update your installation:

git pull origin main
npm install

The npm install command ensures any new dependencies are downloaded. Restart OpenClaw after updating.

Configuration Migration

Major updates may introduce new configuration options. Compare .env.example with your .env file after updating and add new variables as needed. Check release notes for deprecated settings.

Next Steps

You now have a fully functional OpenClaw installation connected to WhatsApp and Claude AI. Here's how to continue your journey:

Expand Your Capabilities

  • Explore ai-agents to understand OpenClaw's position in the broader AI agent ecosystem
  • Learn about custom handler development to extend OpenClaw with specialized commands
  • Integrate with other llm-frameworks for multi-model support
  • Join the OpenClaw community on GitHub Discussions to share experiences and get help

Contributing Back

OpenClaw is open source and welcomes contributions:

  • Report bugs and suggest features through GitHub Issues
  • Submit pull requests for bug fixes or enhancements
  • Improve documentation based on your setup experience
  • Share your custom configurations and workflows with the community

Explore Related Technologies

Deepen your understanding of the underlying technologies:

  • Study Anthropic's Claude API documentation for advanced prompting techniques
  • Learn about whatsapp-automation for complementary integrations
  • Investigate self-hosted-ai best practices for running AI agents locally
  • Research security frameworks for agent-frameworks operating with system-level access

Conclusion

OpenClaw represents a powerful convergence of conversational AI and local system control, putting Claude's intelligence at your fingertips through the familiar WhatsApp interface. By completing this tutorial, you've gained hands-on experience with AI agent deployment, API integration, security configuration, and practical automation techniques applicable far beyond this specific tool.

The self-hosted nature of OpenClaw gives you complete control over your data and system interactions while maintaining the convenience of mobile access. As AI capabilities continue advancing, tools like OpenClaw will increasingly serve as bridges between human intent and computer execution, making powerful automation accessible to developers without requiring extensive scripting expertise.

Remember that with great power comes responsibility—the security practices and configuration strategies covered here apply to any system-level AI integration. Start conservatively, expand capabilities gradually, and always maintain security awareness as you explore OpenClaw's potential.

Tutorial based on OpenClaw documentation, community guides, and installation resources from YouTube and Medium articles about Clawdbot/Moltbot setup processes.

Share:

Original Source

https://www.youtube.com/watch?v=Q8Si8rqjRis

View Original

Last updated: