CLI Reference (bench)
CLI Reference (bench)
bench is the command-line tool for managing Frappe installations. This page covers the most useful commands.
Site management
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
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
# 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
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
bench --site mysite backup --with-files
bench --site mysite restore /path/to/backup.sql.gz
Database
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
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
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
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
bench setup nginx
bench setup supervisor
bench setup production myuser # One-shot production setup
Last updated 3 days ago
Was this helpful?