---
slug: mem0
kind: runbook
status: docs-checked
sh: https://insidethemachine.ai/install/mem0.sh
ps1: null
json: https://insidethemachine.ai/install/mem0.json
page: https://insidethemachine.ai/setups/mem0
---

# Install: Mem0

A memory layer for agents that can run fully local with Ollama and Qdrant.

**Run status: Not run: commands checked against the official docs only.** Commands checked against the official docs on 2026-10-15. Not run end to end.

**This script:** The wrapper scripts are generated from the site data. Every .sh passed bash -n and shellcheck and ran in plan mode on Linux (Debian 13). Every .ps1 passed the PowerShell parser and chat.ps1 ran in plan, verify and rollback mode under PowerShell 7 on Linux with Windows calls mocked. Not run on macOS or real Windows.

## One command

```bash
curl -fsSL https://insidethemachine.ai/install/mem0.sh | bash
```

Actions: `| bash -s -- plan` (print only), `verify`, `rollback --yes`. Env: ITM_RAM. Read the script first: `curl -fsSL https://insidethemachine.ai/install/mem0.sh | less`.

Lines marked YOU RUN are not run by the script (servers, interactive apps, your own files). The script prints them at the end, in order.

## Steps

### macOS

Install:

1. **Install Mem0**
   - run: `python3 -m venv ~/.venvs/mem0 && source ~/.venvs/mem0/bin/activate`
   - run: `pip install mem0ai`
   - run: `ollama pull llama3.1:latest && ollama pull nomic-embed-text:latest`
   - YOU RUN (needs Docker; starts a container): `docker run -d -p 6333:6333 --name qdrant qdrant/qdrant`
2. **Configure (your choices)**
   - YOU RUN (config adapted verbatim from Mem0's 'Self-Hosted AI Companion' cookbook): `cat > mem0_local.py <<'EOF'
from mem0 import Memory
config = {
  "vector_store": {"provider": "qdrant", "config": {"collection_name": "test", "host": "localhost", "port": 6333, "embedding_model_dims": 768}},
  "llm": {"provider": "ollama", "config": {"model": "llama3.1:latest", "temperature": 0, "max_tokens": 2000, "ollama_base_url": "http://localhost:11434"}},
  "embedder": {"provider": "ollama", "config": {"model": "nomic-embed-text:latest", "ollama_base_url": "http://localhost:11434"}},
}
m = Memory.from_config(config)
m.add("I'm visiting Paris", user_id="john")
print(m.get_all(filters={"user_id": "john"}))
EOF`

Verify:

- by hand: `python mem0_local.py` → expect: prints a results list containing a memory about visiting Paris

Rollback:

- run: `pip uninstall -y mem0ai`
- run: `docker rm -f qdrant`
- run: `rm mem0_local.py`

### Linux

Install:

1. **Linux: same steps as macOS**
   - note: Our data lists Linux as supported but has no separate Linux steps, so these are the macOS steps. brew lines are skipped; install those tools with your package manager.
2. **Install Mem0**
   - run: `python3 -m venv ~/.venvs/mem0 && source ~/.venvs/mem0/bin/activate`
   - run: `pip install mem0ai`
   - run: `ollama pull llama3.1:latest && ollama pull nomic-embed-text:latest`
   - YOU RUN (needs Docker; starts a container): `docker run -d -p 6333:6333 --name qdrant qdrant/qdrant`
3. **Configure (your choices)**
   - YOU RUN (config adapted verbatim from Mem0's 'Self-Hosted AI Companion' cookbook): `cat > mem0_local.py <<'EOF'
from mem0 import Memory
config = {
  "vector_store": {"provider": "qdrant", "config": {"collection_name": "test", "host": "localhost", "port": 6333, "embedding_model_dims": 768}},
  "llm": {"provider": "ollama", "config": {"model": "llama3.1:latest", "temperature": 0, "max_tokens": 2000, "ollama_base_url": "http://localhost:11434"}},
  "embedder": {"provider": "ollama", "config": {"model": "nomic-embed-text:latest", "ollama_base_url": "http://localhost:11434"}},
}
m = Memory.from_config(config)
m.add("I'm visiting Paris", user_id="john")
print(m.get_all(filters={"user_id": "john"}))
EOF`

Verify:

- by hand: `python mem0_local.py` → expect: prints a results list containing a memory about visiting Paris

Rollback:

- run: `pip uninstall -y mem0ai`
- run: `docker rm -f qdrant`
- run: `rm mem0_local.py`
