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.gzApp 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-appsDevelopment 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 mariadbUser 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.comProduction 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 --pullDebugging
# 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.logBookmark this page. These commands cover 90% of what you’ll need for day-to-day ERPNext administration and development.
Comments
Join the discussion. Got a question, found an issue, or want to share your experience?