Skip to main content

Overview

The bench init command creates a new bench instance in a specified directory. It sets up the complete environment including Python virtual environment, clones the Frappe framework, configures Redis, creates a Procfile for process management, and optionally installs specified apps.

Syntax

bench init [PATH] [OPTIONS]

Arguments

PATH
string
required
The directory path where the bench instance will be created. This can be a relative or absolute path.

Options

--frappe-branch
string
default:"None"
Clone a particular branch of Frappe. Alias: --version
bench init frappe-bench --frappe-branch version-15
--python
string
default:"python3"
Path to the Python executable to use for creating the virtual environment.
bench init frappe-bench --python python3.11
--ignore-exist
boolean
default:"false"
Ignore if a bench instance already exists at the specified path. Without this flag, init will fail if the directory exists.
--apps_path
string
default:"None"
Path to a JSON file containing a list of apps to install after initialization.
--frappe-path
string
default:"None"
Path to an existing Frappe repository to use instead of cloning from remote.
--clone-from
string
default:"None"
Copy repositories from an existing bench directory instead of cloning from remote sources.
--clone-without-update
boolean
default:"false"
When using --clone-from, copy repos without running git pull to update them.
--no-procfile
boolean
default:"false"
Do not create a Procfile for process management. Use this if you plan to manage processes differently.
--no-backups
boolean
default:"false"
Do not set up automatic periodic backups for all sites on this bench.
--skip-redis-config-generation
boolean
default:"false"
Skip Redis configuration generation. Useful when you’re providing a custom common_site_config.json with Redis settings.
--skip-assets
boolean
default:"false"
Do not build front-end assets after initialization. Useful for faster setup when you’ll build assets later.
--install-app
string
default:"None"
Install a particular app immediately after bench initialization.
bench init frappe-bench --install-app erpnext
--verbose
boolean
default:"false"
Enable verbose output during the installation process.
--dev
boolean
default:"false"
Enable developer mode and install development dependencies. This is useful for Frappe app development.

Usage Examples

Basic Initialization

Create a new bench with default settings:
bench init frappe-bench

Initialize with Specific Frappe Version

Create a bench with a specific Frappe branch:
bench init frappe-bench --frappe-branch version-15

Development Setup

Initialize a bench for development with dev dependencies:
bench init frappe-bench --dev

Production-Ready Setup

Create a bench without assets build (for faster setup) and without automatic backups:
bench init production-bench --skip-assets --no-backups

Clone from Existing Bench

Copy apps from an existing bench directory:
bench init new-bench --clone-from ~/existing-bench

Custom Python Version

Specify a particular Python executable:
bench init frappe-bench --python /usr/bin/python3.11

Install App During Init

Initialize bench and immediately install an app:
bench init frappe-bench --install-app erpnext

Common Patterns

Quick Development Setup

For developers who want to get started quickly:
bench init frappe-bench --dev --skip-assets --frappe-branch develop
cd frappe-bench
bench start

CI/CD Pipeline Setup

For automated builds and testing:
bench init ci-bench --no-backups --skip-assets --apps_path apps.json

Error Handling

If initialization fails, you’ll be prompted to rollback changes. The command will automatically clean up the partially created bench directory if you confirm the rollback.
If a bench already exists at the specified path, the command will exit with an error unless you use the --ignore-exist flag.

What Gets Created

When you run bench init, the following structure is created:
  • apps/ - Directory containing all Frappe apps
  • sites/ - Directory for site instances
  • env/ - Python virtual environment
  • config/ - Configuration files (Procfile, Redis configs)
  • logs/ - Log files directory
  • archived/ - Archived files directory

Build docs developers (and LLMs) love