> ## Documentation Index
> Fetch the complete documentation index at: https://docs.snack.money/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Install the Snack Money CLI

The Snack Money CLI can be installed in multiple ways. Choose the method that works best for your workflow.

## npx (Recommended)

The simplest way to use the CLI is with **npx** - no installation required:

```bash theme={null}
npx snackmoney --help
```

This automatically downloads and runs the latest version. Perfect for:

* One-time usage
* Quick testing
* CI/CD pipelines
* Avoiding global installs

### Example Usage

```bash theme={null}
# Send a payment
npx snackmoney send x/username 0.01

# View help
npx snackmoney --help

# Check version
npx snackmoney --version
```

## npm Global Installation

Install globally with npm to use the `snackmoney` command directly:

```bash theme={null}
npm install -g snackmoney
```

After installation, you can run commands without `npx`:

```bash theme={null}
snackmoney send x/username 0.01
snackmoney batch-send ./payments.json
snackmoney --help
```

### Updating

Keep the CLI up to date:

```bash theme={null}
npm update -g snackmoney
```

### Uninstalling

Remove the global installation:

```bash theme={null}
npm uninstall -g snackmoney
```

## Homebrew (macOS/Linux)

Install via Homebrew for system-level package management:

```bash theme={null}
# Add the Snack Money tap
brew tap snack-money/tap

# Install the CLI
brew install snackmoney
```

After installation:

```bash theme={null}
snackmoney --help
```

### Updating

```bash theme={null}
brew update
brew upgrade snackmoney
```

### Uninstalling

```bash theme={null}
brew uninstall snackmoney
brew untap snack-money/tap
```

## Prerequisites

Regardless of installation method, you need:

### 1. Node.js

* **Version**: Node.js 20 or higher
* **Check version**: `node --version`
* **Install**: [nodejs.org](https://nodejs.org/) or use [nvm](https://github.com/nvm-sh/nvm)

### 2. Private Key

You need a private key for the blockchain network you want to use:

**For Base (EVM):**

```bash theme={null}
export EVM_PRIVATE_KEY="0x..."
```

**For Solana (SVM):**

```bash theme={null}
export SVM_PRIVATE_KEY="your_base58_private_key"
```

**Important Security Notes:**

* Never commit private keys to version control
* Use environment variables or `.env` files
* Keep your keys secure and backed up
* Only fund with amounts you're willing to use

### 3. USDC Balance

Ensure your wallet has sufficient USDC on the network you're using:

* **Base**: USDC on Base mainnet
* **Solana**: USDC on Solana mainnet

You can check your balance at:

* Base: [BaseScan](https://basescan.org/)
* Solana: [Solana Explorer](https://explorer.solana.com/)

## Environment Setup

Create a `.env` file in your project directory:

```bash theme={null}
# For Base network
EVM_PRIVATE_KEY=0x1234567890abcdef...

# For Solana network
SVM_PRIVATE_KEY=5Jx7Ry8...

# Optional: AI features (Anthropic or OpenAI)
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
```

The CLI will automatically load variables from `.env` files in the current directory.

## Verifying Installation

Test your installation:

```bash theme={null}
# Check version
npx snackmoney --version

# View help
npx snackmoney --help

# List available commands
npx snackmoney
```

Expected output:

```
Commands:
  send                  Send USDC to a single user
  batch-send            Send USDC to multiple users
  ai-agent              AI-powered payment agent

Options:
  --version             Show version number
  --help                Show help
```

## Troubleshooting

### "command not found: snackmoney"

If using global installation, ensure npm global bin is in your PATH:

```bash theme={null}
# Check npm global bin location
npm bin -g

# Add to PATH (add to ~/.bashrc or ~/.zshrc)
export PATH="$(npm bin -g):$PATH"
```

### Permission Errors (macOS/Linux)

If you encounter permission errors with global npm install:

```bash theme={null}
# Option 1: Use npx instead (recommended)
npx snackmoney

# Option 2: Fix npm permissions
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
```

### Node Version Issues

If you have an older Node.js version:

```bash theme={null}
# Using nvm (recommended)
nvm install 20
nvm use 20

# Verify
node --version
```

## Next Steps

Now that you have the CLI installed:

1. [**Quick Start**](/cli/quick-start) - Send your first payment
2. [**Commands**](/cli/send) - Learn all available commands
3. [**View on GitHub**](https://github.com/snack-money/snackmoney-cli) - Source code and examples
