The Awesome Factor

Compiling Factor on the Intel Mac

Thursday, November 23, 2006

#darcs #mac

To compile Factor for Mac you will need:

  • Installation DVDs that came with your Mac (for X11)
  • darwin-ports
  1. Run the installation disk that came with your Mac in order to install X11. Since Apple does not offer X11 as a download for OS X 10.4 for Intel computers, you have to install from the DVD.

  2. Download the darcs binary and place it in /usr/local/bin

  3. Open terminal (Finder->Applications->Utilities->Terminal) and go to your home directory. To get the Factor source code, run:

    darcs get http://factorcode.org/repos
    
  4. To compile, move into the directory darcs created with cd repos/Factor and run the command make macosx-x86

  5. Download the boot image at http://factorcode.org/images/latest/boot.image.pentium4

  6. ./f boot.image.pentium4

  7. make macosx.app

  8. (Optional) Create a shell script to start Factor in your terminal window. I called mine go.

    #!/bin/sh
    DIR=~/repos/Factor/Factor.app/Contents
    $DIR/MacOS/Factor $@
    
    Save the file and run chmod a+x go
    
  9. (Optional) You can instead run open Factor.app and use Console.app to view runtime output.

To start the UI, run ./go or open Factor.app; run ./f to start Factor in the shell. If you run Factor in the terminal, I suggest using rlwrap, which adds a history buffer

Now you can code anything!