Skip to content

Turning a Mac into a Frappe Framework Developer Machine

Azharul Islam edited this page Dec 31, 2018 · 38 revisions

This short instruction explains how to get your Mac OS X machine to be a development platform for Frappe and ERPNext as well as showing how to install Frappe in Developer Mode.

Attention, this gives you more control about what is happening but is harder than the installer. However this is setting up a development framework rather than a quick test of frappe framework. So if you want to try out ERPNext development maybe consider the vagrantfile or the automated setup, if you want a real development machine, consider this tutorial. You are highly recommended to start with a fresh machine here unless you are a mac wizz in which case you won't need this instruction to begin with.

This works best with a clean setup / install.

Install Pre-requisites

Homebrew

Any development on a Mac starts with a Homebrew install.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

(check the brew.sh homepage for the latest script). Homebrew will also install XCode Command Line Tools. If you are unable to install it via the homebrew script, you can download command line tools from the Apple Developer Website

https://developer.apple.com/download/more/

Install Python 3

MacOS (upto 10.4) comes with Python 2 as the default, so its best to install Python 3, which is the latest and greatest python

brew install python3

Install MariaDB and Redis

Frappe requires MariaDB as the default database backend and Redis for caching.

brew install mariadb redis

Start MySQL by

mysql.server start

Setup your default MariaDB passwords using the mysql_secure_installation utility. Just follow the prompts to set your default root password

mysql_secure_installation

Installing Node

Frappe (version 11) uses Node v10 so you can manage your node installs using the awesome Node Version Manager (nvm)

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

Then install Node v10

nvm install v10

Setting up Frappe Bench

Set up your development folder, typically in your user folder and clone the bench-repo into it

mkdir frappe
cd frappe
git clone https://github.com/frappe/bench bench-repo

Install the bench-repo:

Create a virtual environment for Bench (Python 3) so that it does not interfere with the default Python install that comes with MacOS

virtualenv bench-env --python /usr/local/bin/python3
source bench-env/bin/activate

Note: You will have to activate bench-env everytime you want to use the bench command.

Install bench in the environment:

pip install -e bench-repo

Create a new Bench

bench init frappe-bench --python /usr/local/bin/python3

Change into the frappe-bench folder and install the develop branch of ERPNext

cd frappe-bench
bench get-app erpnext https://github.com/frappe/erpnext.git

Open my.cnf make sure to add the required code

please add:

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

[mysql]
default-character-set = utf8mb4

Install a new site

Start Bench on a terminal with:

bench start

If all goes well, open another Terminal tab and create a new site.

bench new-site site1.local`

Update the site to your /etc/hosts so you can run it locally. Add the following line to your /etc/hosts

127.0.0.1 site1.local
bench install-app erpnext

Enable Developer Mode via Site Config

Add "developer_mode": 1 in your sites/site1.local/site_config.json like this, the rest stays:

{
 "db_name": "1bd3e0294d", 
 "db_password": "jfhgsdfjgh35h34j",
 "developer_mode": 1
}

bench update

Open your browser and enjoy

Navigate to URL: http://site1.local:8000/#login