Skip to content

Setting up the development environment on Mac

josmas edited this page Feb 6, 2012 · 13 revisions

Note: if you are a Macports user, see the comments at the end of point 2.

Note: The easiest way to test Lernanta locally is using sqlite3, and for that you do not need to install MySQL.

1. Installed homebrew using the instructions https://github.com/mxcl/homebrew/wiki/installation. Please note that if you have installed Macports before, Macports and Homebrew are not friends. Macports will need to be completely uninstalled from your computer. You will also need to have already installed Xcode.

2. Installed MySQL, Python, Pip, virtualenv, virtualenvwrapper, gettext

  #installing mysql  (if you rather use MySQL instead of sqlite3)
  brew install mysql 
  
  #installing Python prerequisites per http://youshoulddoityourself.blogspot.com/2010/11/test.html 
  brew install readline sqlite gdbm 
  
  #installing Python 
  brew install python --universal --framework 

  #installing gettext (required for translation)
  brew install gettext

  #installing PIL (for handling images)
  brew install pil

For Macports users, the commands are:

  # Installing MySQL (if you rather use MySQL instead of sqlite3)
  sudo port install mysql5

  # Installing readline, gettext, etc.
  sudo port install sqlite3
  sudo port install readline
  sudo port install gettext

I then had to manually add /opt/local/lib/mysql5/bin to my PATH so that this line:

  pip install -r requirements/compiled.txt

from the standard installation instructions would be able to find mysql_config.

3. At this point, I followed the advice in the blog post above and /etc/paths so that /usr/local/bin was at the top of the file. Then, I installed pip.

  #installing pip 
  #The Python formula installs Distribute 0.6.15, which provides easy_install. pip can then be installed with:
  easy_install pip
  
  #using pip to install virtualenv and virtualenvwrapper 
  pip install virtualenv 
  pip install virtualenvwrapper

4. Set up symlink for virtualenv in the bin directory (only applies if you have used homebrew to install python)

  cd /usr/local/bin
  ln -s /usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/bin/virtualenv virtualenv

5. Added the virtualwrapper script to my .profile file (could have done .bash_profile or .bashrc instead)

  export WORKON_HOME=$HOME/virtualenvs
  source /usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/bin/virtualenvwrapper.sh

After this point, I was able to follow the Lernanta instructions the start with "Once installed, create your virtual environment for lernanta and install the dependencies."

By Julia Kulla-Mader (with Macports notes by Greg Wilson) From http://new.p2pu.org/en/groups/introduction-to-contributing-to-lernata/content/task-two-create-development-environment/#834

Clone this wiki locally