# Installation

## Prerequisites

- Node.js 18.0.0 or higher
- That's it! No Redis or API keys required

## Quick Start (Zero Configuration)

```bash
# Run immediately with npx
npx r3

# Or install globally
npm install -g r3
r3
```

r3 automatically starts an embedded Redis server - no setup needed!

## Package Installation

### npm

```bash
npm install r3
```

### Yarn

```bash
yarn add r3
```

### pnpm

```bash
pnpm add r3
```

## Optional Configuration

### Enable Cloud Sync (Optional)

```bash
# Get a free API key from mem0.ai
MEM0_API_KEY="your-mem0-api-key"

# Use external Redis (optional - embedded by default)
REDIS_URL="redis://localhost:6379"
```

### Antigravity CLI Integration

Add to `~/.gemini/settings.json`:

```json
{
  "mcpServers": {
    "recall": {
      "command": "npx",
      "args": ["r3"],
      "env": {
        "MEM0_API_KEY": "your-api-key",
        "REDIS_URL": "redis://localhost:6379"
      }
    }
  }
}
```

## Running as a Service

### macOS (launchd)

Create `~/Library/LaunchAgents/com.recall.plist`:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.recall</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/node</string>
        <string>/usr/local/bin/recall</string>
    </array>
    <key>EnvironmentVariables</key>
    <dict>
        <key>MEM0_API_KEY</key>
        <string>your-key</string>
        <key>REDIS_URL</key>
        <string>redis://localhost:6379</string>
    </dict>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
</dict>
</plist>
```

Load the service:

```bash
launchctl load ~/Library/LaunchAgents/com.recall.plist
```

### Linux (systemd)

Create `/etc/systemd/system/recall.service`:

```ini
[Unit]
Description=Recall Memory Service
After=network.target redis.service

[Service]
Type=simple
User=youruser
ExecStart=/usr/bin/node /usr/local/bin/recall
Restart=always
Environment="MEM0_API_KEY=your-key"
Environment="REDIS_URL=redis://localhost:6379"

[Install]
WantedBy=multi-user.target
```

Enable and start:

```bash
sudo systemctl enable recall
sudo systemctl start recall
```

## Verification

Test your installation:

```bash
# Using the CLI
recall-cli

# Or test programmatically
node -e "
const { Recall } = require('@n3wth/recall');
const memory = new Recall();
memory.health().then(console.log);
"
```

Source: https://r3.n3wth.com/docs/installation
