Skip to content

Turning a Mac into a Frappe Framework Developer Machine

Karan Sharma edited this page Aug 31, 2017 · 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 without the beta installer.

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.

Prerequisites and Things a Developer Machine should have

XCode Copy Paste to terminal:

xcode-select --install When that's done agree to the license by opening xcode or by typing sudo xcodebuild -license

Homebrew Copy Paste to terminal:

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

Usage:

brew install 'package name' brew list # See all installed pachages brew doctor # Fix things brew update # Update, suggestion once a day

Brew Cask Copy Paste to terminal:

brew tap caskroom/cask

Usage: Install Mac Os applications brew cask install 'app_name'

Everything Else

  1. iTerm2 (an better terminal)

brew cask install iterm2

  1. Atom (Github free editor)

brew cask install atom

  1. ZSH (an better bash)

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

  1. Install python (via brew will update the allready installed python to brew links)

brew install python

  1. GIT

brew install git

  1. node.js (will give you access to npm)

brew install node

  1. redis

brew install redis

  1. Mariadb

Attention! Currently ´mysqlclient´ doesn't work with ´MariaDB 10.2.x´ so you will have to install ´MariaDB 10.1.x´ until this is resolved.

brew install mariadb@10.1

export PATH="/usr/local/opt/mariadb@10.1/bin:$PATH"

If this error is resolved, use 10.2.x instead:

brew install mariadb

mysql.server start

Please run mysql_secure_installation right after to secure and set root password (mandatory)

  1. Wkhtmltopdf

brew cask install Caskroom/cask/wkhtmltopdf

  1. Installing Virtualenvwrapper

pip install virtualenvwrapper

  1. Adding virtualenvwrapper to your ~/.zshrc ZSH config

atom ~/.zshrc then find the line plugins (probably around 52) and change it to plugins=(git virtualenvwrapper)

  1. Install ipython

pip install ipython to do magical things like running "ls" from within python.

  1. Update pip for python 2.7

pip install --upgrade pip

  1. Install emmet and terminal plus packages in atom Go to Atom -> Preferences -> Install and install emmet Why? https://www.youtube.com/watch?v=Ufg7OKimjfM Also consider adding the plugin terminal plus and enjoy turning atom into an IDE.

  2. Cleaning up brew and brew cask

brew cleanup --force brew cask cleanup this will clean up caches and free a lot of space

Setting up Frappe Bench

  1. 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

  1. Install the bench-repo:

sudo pip install -e bench-repo

  1. Install the master branch of frappe-bench

bench init frappe-bench --frappe-branch master

  1. Change into the frappe-bench folder and install the master branch of ERPNext

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

  1. Open my.cnf with Atom and make sure to add the required code

atom /usr/local/etc/my.cnf

please add:

[mysqld]
innodb-file-format=barracuda
innodb-file-per-table=1
innodb-large-prefix=1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

[mysql]
default-character-set = utf8mb4
  1. Make sure you have run mysql_secure_installation if you havent already set a root password, which is mandatory for the following steps.

  2. Make sure your mariadb server is running by mysql.server start

  3. If you have a messed up setup from previous bench it is recommended you check out if there is a DB in mariadb that should be dropped before continuing.

  4. Install a new site

bench new-site site1.local

input mysql root password when prompted as set in mysql_secure_installation input admin user password you wish to set for website (attention! user is actually called "Administrator")

  1. Install the erpnext app for this new site

bench install-app erpnext

  1. Enable developer mode in site_config.json

atom sites/site1.local/site_config.json

Please add "developer_mode": 1 like this, the rest stays:

{
 "db_name": "1bd3e0294d", 
 "db_password": "jfhgsdfjgh35h34j",
 "developer_mode": 1
}
  1. Update Frappe Bench

bench update

  1. Run frappe bench

bench start

  1. Open your browser and enjoy Navigate to URL: http://localhost:8000/#login

  2. When you are done and before you start coding please type

python -c 'import this'and carefully read it.