[Tutorial] How to Install OpenClaw on Your Local Machine (Mac, Windows, Linux)
# [Tutorial] How to Install OpenClaw on Your Local Machine (Mac, Windows, Linux)
**Category:** AI Agents & Task Runners **Author:** Heather Lawson **Tags:** OpenClaw, installation, tutorial, self-hosted AI, AI setup, command line
---
Hey everyone!
I've had a few people ask for a step-by-step guide on how to install **OpenClaw** locally. It's surprisingly straightforward if you're comfortable with the command line. Let's walk through it!
## Prerequisites
Before you start, you'll need a few things installed on your system:
- **Python 3.10+** - **Git** - **Pip** (Python's package installer)
## Step 1: Clone the OpenClaw Repository
First, you need to download the OpenClaw source code from GitHub. Open your terminal or command prompt and run:
```bash git clone https://github.com/openclaw/openclaw.git ```
This will create a new directory called `openclaw` with all the necessary files.
## Step 2: Navigate to the Directory
Next, move into the newly created directory:
```bash cd openclaw ```
## Step 3: Install Dependencies
OpenClaw has a list of Python packages it depends on. You can install them all with a single command:
```bash pip install -r requirements.txt ```
This might take a few minutes as it downloads and installs everything.
## Step 4: Configure Your API Keys
OpenClaw needs API keys to connect to AI models like GPT-4 or Claude. You'll need to create a `.env` file to store these keys securely.
1. **Create the file:** ```bash touch .env ```
2. **Add your keys:** Open the `.env` file in a text editor and add the following lines, replacing `your_api_key` with your actual keys:
``` OPENAI_API_KEY=your_openai_api_key ANTHROPIC_API_KEY=your_anthropic_api_key ```
You only need to add the keys for the models you plan to use.
## Step 5: Run the Database Migrations
OpenClaw uses a SQLite database to store its memory and settings. You need to initialize it by running the database migrations:
```bash python manage.py migrate ```
## Step 6: Start the OpenClaw Server
Now you're ready to start the main OpenClaw application:
```bash python manage.py runserver ```
You should see output indicating that the server is running, usually on `http://127.0.0.1:8000/`.
## Step 7: Start the Agent Worker
Finally, you need to start the background worker that actually executes the tasks. Open a **new terminal window** and run:
```bash python manage.py qcluster ```
This worker will listen for tasks from the main server and run them in the background.
## You're Done!
That's it! You now have a fully functional OpenClaw instance running on your local machine. You can access the web interface at `http://127.0.0.1:8000/` and start creating your first agents.
## Troubleshooting
- **`command not found`:** Make sure you have Python, Git, and Pip installed and in your system's PATH. - **Dependency errors:** Try creating a virtual environment (`python -m venv venv`) before installing requirements to avoid conflicts. - **API key errors:** Double-check that your `.env` file is correctly named and formatted.
Let me know if you run into any issues! I'm happy to help.
---
**Join the discussion on Creator Hive AI - where AI creators connect, learn, and build together!**