Mac OS X Installation Guide

birkanu edited this page Oct 2, 2014 · 4 revisions

1. Install Python 2.7.5

( (2.7.2 causes issues with Django 1.5.1)

Download the Mac Installer for your system. After installing, go to the "Python 2.7" subfolder of the system Applications folder, and double-click on the "Update Shell Profile" to use 2.7.5 from the command line. After doing that, type python --version from the command line to confirm you're using 2.7.5

2. Install apache2 + mod_wsgi


Install MacPorts if you haven’t already. Then:
sudo port install apache2 mod_wsgi

Alternative—if you’re using Homebrew on Mavericks, run:
$ sudo ln -s /Applications/ /Applications/

$ brew install mod_wsgi

Using your favorite text editor, open up the file /opt/local/apache2/conf/httpd.conf: (In Mavericks, the file is located at /private/etc/apache2/httpd.conf. If file is read only, first run: sudo chmod 777 httpd.conf)

Add the following line:

LoadModule wsgi_module modules/

In the same file, uncomment:

Include conf/extra/httpd-vhosts.conf

3. Install Postgres

Install Postgresapp:

Add the following to your PATH (in .profile, .bashrc, .bash_profile, or .zshrc, in your home directory): cd ~/


Start Postgres, then run the command-line interface by typing psql

If successful, enter the following to create a local NB database:

# CREATE USER nburop WITH PASSWORD 'ur0p34501';

4. Install Python packages + Django

sudo easy_install pip
sudo pip install numpy
sudo pip install pypdf2

Change all instances of "pypdf" to "PyPDF2" in /apps/upload/ Once you're done setting everything up and you try to upload a pdf file, you might get a Permission Denied error. Run "chmod ugo+rwx /var/local/nb/pdf/repository" and "chmod ugo+rwx /var/local/nb/pdf/cache2"

sudo pip install psycopg2
sudo pip install xlwt
sudo pip install python-openid
sudo pip install setuptools
sudo pip install --pre pytz

sudo pip install Django==1.5.4
sudo pip install django-openid-auth
sudo pip install django-facebook-oauth

(NOTE: Currently ‘facebook’ module is missing, so it’s commented out in the INSTALLED_APPS list in

5. Install Grunt

Install nodejs:
Then install Grunt:

sudo npm install -g grunt-cli

6. Install mupdf

sudo port install mupdf
Change instances of “pdfdraw” in the codebase to “mudraw” (currently in apps/upload/, line 93).

NOTE: To ignore this file on git, go to your working directory, and edit .git/info/exclude to add this line (you might have to create it as a new file):


Then in the terminal, type: git update-index --assume-unchanged apps/upload/

7. Install other dependencies

Install imagemagick:
Install ConTeXt (for rich, i.e. annotated pdf generation): (I did it via MacText distribution, as recommended)

Start postfix (to enable sending mail if faced with “Connection refused”):
sudo postfix start

NOTE: On Mavericks, need to install different gcc from xcode default

8. Install the app

Once you've satisfied the dependencies listed above, you need to run the following installation commands:
cd nbproject (or whatever name you may have chosen for the root NB code directory).
npm install in order to install specific grunt modules, such as grunt-css, execSync
make django create configuration files. You can safely ignore the "Error 127" message

In, set

DEBUG = True   
Also set the following for DATABASES (to match the table created in Postgres above):  
    'default': {  
    'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.  
    'NAME': 'nburop',                      # Or path to database file if using sqlite3.  
    'USER': 'nburop',                      # Not used with sqlite3.  
    'PASSWORD': 'ur0p34501',                  # Not used with sqlite3.  
    'HOST': 'localhost',                      # Set to empty string for localhost. Not used with sqlite3.  
    'PORT': '',                      # Set to empty string for default. Not used with sqlite3.  

sudo make create_dirs create root folder and some folders below that for nb data
make django one more time...
grunt Compiles js and css.

Then from the apps directory, you should be able to:
./ syncdb
./ runserver

In your browser visit http://localhost:8000

You should be able to see the home page, but the server will throw an error if you try to create a group without configuring an endpoint for the authentication email

9. Configure the Email Endpoint

From the apps directory, open nbsite/ and uncomment the lines that set the values of EMAIL_BACKEND and EMAIL_FILE_PATH (~Line 26 currently). Then set:

EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
EMAIL_FILE_PATH = '/tmp/nb_emails'

10. Access the NB Desktop

Open http://localhost:8000 in a browser again and click the Log In/Sign Up link in the top right, then choose to create a new group. Fill out the form (make sure you remember your username and password so you can log in later) and submit it. It should tell you it sent the verification email. There should now be one file in the directory /tmp/nb_emails. This is the verification email. Read the file and look for the line:

To start using NB, please visit http://localhost?ckey=XXX

XXX here is the verification key.
In your browser visit: http://localhost:8000?ckey=XXX
(So be sure to insert the port number into the URL if you copy/paste)
You should now be on the NB Desktop!

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.