Skip to content

Turning a Mac into a Frappe Framework Developer Machine

Rushabh Mehta edited this page Nov 6, 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

Change your default Python to 3 by adding the following to your ~/.bash_profile

alias python='python3'
alias python2='/usr/bin/python'
alias pip='pip3'

Install MariaDB and Redis

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

brew install mariadb redis

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

mysql_secure_installation

Start MySQL by

mysql.server start

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 Dev
cd Dev
git clone https://github.com/frappe/bench bench-repo

Install the bench-repo:

pip install -e bench-repo

Install the develop branch of frappe-bench

bench init frappe-bench

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