Jan
29
2010
Installing Factor: A Gentle Introduction
Author: ClayI recently decided to try out the Factor programming language.
Factor is a modern, concatenative language that comes with all the bells and whistles (some might say “batteries”) of modern dynamic languages. However, it also adds a development environment lifted from Smalltalk, an object system modeled on Common Lisp’s object system, and the functional power of Forth. To be honest, I’m still testing the waters, but what I’ve seen so far has me really excited.
However, I’ve noticed that people seem a little scared to take Factor out for a test drive, and that’s a shame because this language is really cool.
As some have pointed out, this reluctance may be related to the fact that there aren’t any Debian packages for a quick apt-get install. To be fair, the Factor team does have precompiled binaries on the main Factor website for easy download, but for some reason, I don’t like downloading binaries like that–and I suspect I’m not alone. The Factor team has also posted instructions for doing a manual build, but I found the directions a bit spread out for my taste, so I decided to reformat those instructions here.
This post is intended to gently walk the reader through the Factor install process from start to finish. (It’s actually very easy)
A brief road map (details will follow):
- Install Git (1 command line entry)
- Clone the Factor repository (1 command line entry)
- Install the 7 necessary dependencies (1 command line entry)
- Use Factors automatic build utility (1 command line entry)
So, building Factor from scratch requires a grand total of four lines of code that I’m about to give you. Piece of cake.
STEP ONE: Install Git
Git is an extremely popular piece of software that essentially tracks changes that people make to documents. Anyone who has ever written a paper and saved multiple versions as copy1, copy2, copy3, etc… understands the difficulty that quickly arises with tracking changes manually. Git is designed to remove those headaches by tracking each change to a document silently. For programs–like Factor–these individual documents quickly start adding up, and Git helps manage the logistics of tracking all the changes people make to the code base.
But it does something else too, it also provides an easy way to distribute the code base. We’re going to install Git in order to have it automatically download the complete set of files for us to build. This would probably be a lot of work if we wanted to do it manually, but with Git, the whole thing is literally 1 line of text to type at the command line.
So, first, let’s install Git by typing the following at your command line in Bash:
sudo apt-get install git
For those who’ve forgotten, “sudo” essentially authorizes your computer to start installing software, “apt-get install” tells your computer to automatically download and install the specified program, and “git” tells your computer what program to install.
Then just sit back and enjoy the show. It should download and install Git automatically for you without anymore fuss.
STEP TWO: Clone the Factor Repository
This sounds really fancy, but actually, all it means is tell Git (now that we’ve installed it) to automatically download Factor’s code base for you. Here’s the command to tell Git to download Factor for you:
git clone git://factorcode.org/git/factor.git
Alright, you should now have a directory called factor. If it’s there, celebrate. You’re almost there.
STEP THREE: Install Dependencies
This is actually just another apt-get install, which means that we technically could have performed this task when we used apt-get to install Git; however, I like to break things up so I don’t forget anything. Dependencies are programs that Factor needs in order to properly build itself on your computer, as in, Factor depends on them, get it? So, we’re going to make sure your computer has them by typing the following:
sudo apt-get install g++ libc6-dev libpango1.0-dev libx11-dev libgl1-mesa-dev libsqlite-dev libssl-dev
STEP FOUR: Use Factor’s Build Script to AutoMagically Do The Rest
This is the final and easiest part. CD (change directory) into your factor directory. The considerate designers of factor have developed a simple install script that automates all the configuring and building for us. Just type the following:
./build-support/factor.sh update
And that should do it.
To start factor, just type the following in your factor directory:
./factor
If you see something called the Listener pop up, rejoice. You’ve done it.