MODULE 04 · COURSE 01: YOUR FIRST AI AGENT
Module 4: Installing OpenClaw
This is the part most guides overcomplicate. It's not complicated.
The install command
Open your terminal and run:
npm install -g openclaw@latest
That's it. OpenClaw is now installed globally on your machine.
To confirm it worked:
openclaw --version
You should see a version number. If you get "command not found," your npm global bin isn't in your PATH — see the troubleshooting note at the bottom of this module.
Run the onboarding wizard
OpenClaw has a built-in setup wizard that walks you through everything:
openclaw onboard --install-daemon
The --install-daemon flag tells it to install OpenClaw as a background service so it starts automatically when your computer boots. If you'd rather manage it manually, leave that flag off.
The wizard will ask you:
- Which AI provider you want to use (pick Anthropic if you're following this course)
- Your API key
- Basic config preferences
What just happened?
After onboard completes, a few things exist on your machine:
~/.openclaw/openclaw.json
This is where all your settings live. You can edit this directly later, but the wizard handles the basics.
The workspace: A folder your agent uses as its home. By default it's somewhere under ~/.openclaw/ but if you're running a named agent (like in this course) it'll be in a dedicated folder.
The daemon (if you used --install-daemon): A background service managed by your OS. On macOS it's a launchd service. On Linux it's systemd.
Start the Gateway
If you didn't use --install-daemon, or you want to start it manually for now:
openclaw gateway --port 18789
This starts the Gateway on port 18789. You'll see log output in your terminal. Keep this window open while you're testing.
If you want to run it in the background:
openclaw gateway start
And stop it with:
openclaw gateway stop
Check that it's running
openclaw gateway status
Or open your browser to:
http://127.0.0.1:18789
You should see the OpenClaw Control UI — a dashboard where you can see sessions, configure things, and even chat directly.
Troubleshooting
"command not found: openclaw" Your npm global directory isn't in your PATH. Runnpm config get prefix to find where npm installs global binaries, then add <prefix>/bin to your PATH in your shell config (.bashrc, .zshrc, etc.).
"EACCES: permission denied"
You're trying to install globally without the right permissions. Don't use sudo with npm — instead, fix npm's global directory ownership. npm's official guide covers this.
Node version too old
If you see an error about Node version, upgrade to v22+. Use nvm (Node Version Manager) if you want to manage multiple versions cleanly.
Port already in use
Change the port: openclaw gateway --port 18790. Make sure to use the same port everywhere if you change it.