Installing Locally on macOS

Is this the best installation method for you?

In most cases, we recommend doing an internet-based installation on Heroku instead. If you decide to do a local installation, be sure to read our page on local installations to help you understand what’s going on, particularly this section: Should I use a local installation?

If you just want to quickly set up a copy of Tabbycat to run locally on macOS, consider installing using Docker, which is a shorter process than the one below.

Requisite technical knowledge

You need to be familiar with command-line interfaces to get through this comfortably. While a background in the specific tools Tabbycat uses (Python, PostgreSQL, etc.) will make things easier, it’s not necessary: we’ll talk you through the rest. You just need to be prepared to bear with us. It’ll take a while the first time, but it gets easier after that.

Every line in the instructions that begins with $ is a command that you need to run in a Terminal, but without the $: that sign is a convention used in instructions to make it clear that it is a command you need to run.

Advanced users

Tabbycat is a Django project, so can be installed in any manner that Django projects can normally be installed. For example, if you prefer some SQL system other than PostgreSQL, you can use it so long as it’s Django-compatible. Just be aware that we haven’t tried it.

1. Install dependencies

First, you need to install all of the software on which Tabbycat depends, if you don’t already have it installed.

1(a). Python

Tabbycat requires Python 3.5 or later. macOS only comes with Python 2.7, so you’ll need to install this. You can download the latest version from the Python website.

The executable will probably be called python3, rather than python. Check:

$ python3 --version
Python 3.5.2

Warning

Tabbycat does not support Python 2. You must use Python 3.5 or later.

Advanced users

These instructions will use the venv module. If you prefer, you can use Virtualenv instead.

1(b). Postgres.app

Download Postgres.app, move it to your Applications folder, and open it. This should place an icon in your menu bar, showing that the postgres database is running. Whenever you are running Tabbycat you’ll need to have this app running.

You’ll need to use the PostgreSQL command-line tools, so run the command that the Postgres.app suggests in its installation instructions for adding them to your $PATH. As of February 2018, it was:

sudo mkdir -p /etc/paths.d && echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp

1(c). Node.js/NPM

Download and run the node.js 8 macOS Installer (.pkg)

2. Get the source code

  1. Go to the page for our latest release.
  2. Download the zip or tar.gz file.
  3. Extract all files in it to a folder of your choice.

Advanced users

If you’ve used Git before, you might prefer to clone our GitHub repository instead. Don’t forget to check out the v2.1.3 tag or the master branch.

Even better, you might like to fork the repository first, to give yourself a little more freedom to make code changes on the fly (and potentially contribute them to the project).

3. Set up a new database

Hint

You can skip steps 1-3 if this is not your first installation. Every Tabbycat installation requires its own database, but they can use the same login role if you like.

  1. Open up a copy of the Terminal app, then copy/paste or type in:

    $ sudo mkdir -p /etc/paths.d && echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp
    
  2. Hit enter then quit and reopen the Terminal app.

  3. Create a new user account with a password, replacing myusername with whatever name you prefer. If you don’t know what username to pick, use tabbycat.

$ createuser myusername --pwprompt
  1. Create a new database, replacing mydatabasename with whatever name you prefer, probably the name of the tournament you’re running:

    $ createdb mydatabasename --owner myusername
    
  2. In terminal type in:

    $ PATH="/Applications/Postgres.app/Contents/Versions/9.6/bin:$PATH"
    

4. Install Tabbycat

Almost there!

  1. Navigate to your Tabbycat directory:

    $ cd path/to/my/tabbycat/directory
    
  2. Copy local_settings.example to local_settings.py. Find this part in your new local_settings.py, and fill in the blanks as indicated:

DATABASES = {
    'default': {
        'ENGINE'  : 'django.db.backends.postgresql',
        'NAME'    : '',  # put your PostgreSQL database's name in here
        'USER'    : '',  # put your PostgreSQL login role's user name in here
        'PASSWORD': '',  # put your PostgreSQL login role's password in here
        'HOST':     'localhost',
        'PORT':     '5432',
    }
}

Optionally, replace the value in this line in the same file with your own time zone, as defined in the IANA time zone database (e.g., Pacific/Auckland, America/Mexico_City, Asia/Kuala_Lumpur):

TIME_ZONE = 'Australia/Melbourne'
  1. Start a new virtual environment. We suggest the name venv, though it can be any name you like:

    $ python3 -m venv venv
    
  2. Run the activate script. This puts you “into” the virtual environment:

    $ source venv/bin/activate
    
  3. Install Tabbycat’s requirements into your virtual environment:

    $ pip install --upgrade pip
    $ pip install -r requirements_common.txt
    $ npm install
    
  4. Navigate to the tabbycat sub folder, initialize the database, compile the assets, and create a user account for yourself:

    $ cd tabbycat
    $ dj migrate
    $ npm run build
    $ dj collectstatic
    $ dj createsuperuser
    
  5. Start Tabbycat!

$ dj runserver

It should show something like this:

serving on http://127.0.0.1:8000
  1. Open your browser and go to the URL printed above. (In the above example, it’s http://127.0.0.1:8000.) It should look something like the screenshot below. If it does, great! You’ve successfully installed Tabbycat.
Bare Tabbycat installation

Naturally, your database is currently empty, so proceed to importing initial data.

Starting up an existing Tabbycat instance

To start your Tabbycat instance up again next time you use your computer:

$ cd path/to/my/tabbycat/directory
$ source venv/bin/activate
$ dj runserver