---
title: "CLI Reference (bench)"
space: "Frappe Framework"
url: "https://www.prilk.com/docs/frappe-framework/cli-reference"
updated: "2026-05-14"
---

## CLI Reference (bench)

`bench` is the command-line tool for managing Frappe installations. This page covers the most useful commands.

### Site management

```bash
bench new-site mysite.local --admin-password=admin
bench drop-site mysite.local         # Permanent — be sure
bench --site mysite migrate          # Run pending migrations
bench --site mysite clear-cache
bench list-sites
```

### App management

```bash
bench get-app erpnext --branch version-15    # Clone into apps/
bench --site mysite install-app erpnext      # Install on site
bench --site mysite uninstall-app my_app     # Removes data — be sure
bench remove-app erpnext                      # Remove from bench (not site)
```

### Running code

```bash
# Open IPython console with site context
bench --site mysite console

# Execute a Python function
bench --site mysite execute frappe.utils.now

# Execute with arguments
bench --site mysite execute my_app.api.run --args '["arg1", "arg2"]'
```

### Background work

```bash
bench start                          # Start all services (web, worker, scheduler, socketio)
bench restart                        # Restart all
bench worker                         # Run a worker process
bench --site mysite show-pending-jobs
```

### Backups

```bash
bench --site mysite backup --with-files
bench --site mysite restore /path/to/backup.sql.gz
```

### Database

```bash
bench --site mysite mariadb           # Open MariaDB shell with site DB
bench --site mysite reset-perms       # Recreate role permissions
bench setup procfile                  # Regenerate Procfile for development
```

### Diagnostics

```bash
bench --site mysite show-config
bench version                         # Frappe version + installed apps
bench logs                            # Tail web/worker/scheduler logs
bench --site mysite enable_profile    # Profile next request (slow)
```

### Build & dev

```bash
bench build                          # Build all app assets (CSS, JS)
bench build --app my_app             # Just one app
bench watch                          # Auto-rebuild on file change (dev)
bench setup requirements             # Reinstall Python deps
```

### Updating

```bash
bench update --reset                 # Pull latest, run migrations, rebuild assets
bench update --no-backup             # Skip backup step (faster, riskier)
bench switch-to-branch version-15 frappe erpnext   # Change branch for apps
```

### Environment

```bash
bench setup nginx
bench setup supervisor
bench setup production myuser        # One-shot production setup
```
