Setting up a Mac as a Rascal development system

I’ve been using the Mac for the past few weeks to put together some new pages for Rascal and it works well. Here’s how I set it up:

You first need a copy of your Rascal directory /var/www. There are a number of ways you can upload this but initially I used scp. In Terminal, starting from your home directory, make a directory called rascal-dev and copy everything into it:

$ mkdir rascal-dev
$ scp -r root@rascalNN.local:/var/www/ rascal-dev/
...
$ cd rascal-dev

When finished, cd into rascal-dev as shown above. You now need to install the Rascal web framework Flask. There is some good advice on the Flask site where the recommended first step is to install virtualenv. On OS X this requires install_name_tool which is part of Apple’s Xcode developer tools so you need to install these first. With Snow Leopard, after registering as a developer (free), you can login and download Xcode 3.2.6 from the Apple developer site. With Lion the Xcode 4.2.1 installer is available free from the App Store (remember to install it after it has downloaded). You can now install virtualenv and use it to set up a virtual python environment:

$ sudo easy_install virtualenv
...
$ virtualenv env
New python executable in env/bin/python
Installing setuptools............done.

Within this environment, anything else you install will only affect this environment. First you activate the environment:

localhost:rascal-dev davids$ . env/bin/activate
(env)localhost:rascal-dev davids$

(note that the shell prompt has changed) and then install Flask:

(env)localhost:rascal-dev davids$ easy_install Flask

This installs Flask, the Jinja2 template system and the Werkzeug toolkit. The final step is to start your development Rascal web server:

(env)localhost:rascal-dev davids$ python debug_public.py
* Running on http://0.0.0.0:5000/
* Restarting with reloader

If you now open a browser and go to http://localhost:5000/ you should see your Rascal home page.

From now on, whenever you want to do some Rascal development on your Mac, you just open Terminal and type these three lines:

$ cd rascal-dev
$ . env/bin/activate
$ python debug_public.py

Rascal Home Page

One comment on “Setting up a Mac as a Rascal development system

  1. One suggestion about getting the contents of your Rascal /var/www onto your Mac: if you haven’t modified it from its stock condition, it’s probably easiest to just clone the control-freak repository on Github. This repository is the authoritative record of exactly what ends up in /var/www when the Rascal is shipped. Here’s the repo: https://github.com/rascalmicro/control-freak

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s