Bench is the command-line tool that manages everything in ERPNext — from starting the server to running database migrations to managing sites. This is a reference guide for the most useful bench commands you’ll need as an ERPNext admin or developer.

Site Management

# Create a new site
bench new-site mysite.local

# List all sites
bench --site all list-apps

# Use a specific site
bench use mysite.local

# Drop a site (destructive!)
bench drop-site mysite.local --force

# Backup a site
bench --site mysite.local backup --with-files

# Restore a site
bench --site mysite.local restore /path/to/backup.sql.gz

App Management

# Get an app from GitHub
bench get-app erpnext --branch version-15
bench get-app https://github.com/user/custom-app.git

# Install an app on a site
bench --site mysite.local install-app erpnext

# Uninstall an app
bench --site mysite.local uninstall-app custom_app

# Remove an app from bench
bench remove-app custom_app

# List installed apps
bench --site mysite.local list-apps

Development Commands

# Start development server
bench start

# Run database migrations
bench --site mysite.local migrate

# Clear all caches
bench --site mysite.local clear-cache
bench --site mysite.local clear-website-cache

# Run a specific Python function
bench --site mysite.local execute myapp.tasks.run_daily_report

# Open Python console with site context
bench --site mysite.local console

# Open MariaDB shell
bench --site mysite.local mariadb

User Management

# Set admin password
bench --site mysite.local set-admin-password NewPassword123

# Add system manager role to a user
bench --site mysite.local add-system-manager user@email.com

# Disable a user
bench --site mysite.local disable-user user@email.com

Production Commands

# Setup for production (Nginx + Supervisor)
sudo bench setup production username

# Enable/disable scheduler
bench --site mysite.local enable-scheduler
bench --site mysite.local disable-scheduler

# Check scheduler health
bench --site mysite.local doctor

# Update all apps
bench update --pull --build --reset

# Update without resetting
bench update --pull

Debugging

# Check bench version
bench version

# Show pending migrations
bench --site mysite.local show-pending-migrations

# Check background job status
bench --site mysite.local show-pending-jobs

# View error logs
tail -f frappe-bench/logs/frappe.log
tail -f frappe-bench/logs/worker.error.log

Bookmark this page. These commands cover 90% of what you’ll need for day-to-day ERPNext administration and development.

Share this article

Comments

Join the discussion. Got a question, found an issue, or want to share your experience?

Leave a Comment

Your email stays private. We just use it for replies.

Nothing to preview yet.

Use **bold**, *italic*, `code`, ```code blocks```, [link](url), > quote, - list