How to compile mdbtools on Mac OS X 10.4 and 10.5

Update: MacPorts appears to have a working port of mdbtools now.

Prerequisites

You’ll need MacPorts, the mdbtools source, and a simple patch. Use macports to install glib2, libtool, and automake:

port install glib2 libtool automake

One commenter reported that he had to upgrade version 2.5.35 of flex. I had no trouble with the version of flex included with Leopard, viz. 2.5.33.

MDB Tools source

You can get the mdbtools source from CVS, via the instructions at the sourceforge site, and my patch here.

Alternatively, use a git repo I started because CVS makes baby Theanthropos cry:

git clone git://gitorious.org/mdbtools/mainline.git mdbtools

autogen.sh && make && make install

cd into the mdbtools directory and run autogen.sh Pass any configuration args to autogen.sh, and it will pass them along to configure. /usr/local is the default prefix. The options below set the install location, enable compilation of the mdb-sql tool, but not gmdb2, the Gnome MDB File Viewer and debugger.

./autogen.sh --prefix=/users/Matthew/local --enable-sql --disable-gmdb2
make
make install

Assume that make and install work: you can test the results like so:

mdb-ver /path/to/thingy.mdb
mdb-tables /path/to/thingy.mdb
mdb-schema /path/to/thingy.mdb

Installing Arc on Mac OS X

Installing the Arc language on Mac OS X is trivial, assuming you have the right version of MzScheme.

Install MzScheme 352 with MacPorts

Arc requires MzScheme, version 352. The install instructions warn: “Don’t use the latest version. There is said to be some bug/feature in it that breaks Arc.” The version of mzscheme in MacPorts is 371, so we have to tweak the portfile, and the only historical versions of mzscheme I can find portfiles for are 201 and 360. There seem to have been some major build changes between 352 and 360, so I frankensteined the portfile for version 201. You can find my version here. I’m running 10.4.11 on my dev machine, and I haven’t tested anything else.

Thanks go to bitshaker.com for the instructions on setting up a local port repo.

  1. mkdir /Users/Shared/dports/lang/mzscheme
  2. Edit /opt/local/etc/macports/sources.conf to look like this:
    # To enable your local ports repository, uncomment and customize the
    # following line to point at your local dports directory
    # Example: file:///Users/landonf/misc/macports/dports
    #
    # To get macports from the macports rsync server use:
    # rsync://rsync.macports.org/release/ports/
    file:///Users/Shared/dports
    rsync://rsync.macports.org/release/ports/
      
  3. Download this portfile and copy it to /Users/Shared/dports/lang/mzscheme/Portfile
  4. Update the ports index:
    portindex /Users/Shared/dports
  5. When you run port list mzscheme, you should have an entry for mzscheme @352
  6. Install with:
    sudo port install mzscheme @352
  7. Is mzscheme the right version? Does it run?
    $ mzscheme
    Welcome to MzScheme version 352, Copyright (c) 2004-2006 PLT Scheme Inc.
    > (+ 1 2 )
    3
    (exit)
    $
      

Download Arc and run it with mzscheme

Download http://ycombinator.com/arc/arc0.tar and untar it somewhere useful on your system. ~/src/ perhaps?

$ tar -xv arc0.tar
$ cd arc0
$ mzscheme -m -f as.scm 
Use (quit) to quit, (tl) to return here after an interrupt.
arc> (+ 1 2)
3
arc> (quit)

http://arclanguage.org/install

Default fonts too small in gitk on OS X when installed with MacPorts

This is an easy one, addressed obliquely by the blog post that is the number one result in Google. The blogger also sets his font to Arial, which no one should emulate.

Gitk works pretty much straight out of MacPorts. Bravo, except for the 9 point fonts. Really.

Launch X11 and cd to your git repository in xterm. Run gitk and marvel at the unreadable text.

Edit the top three lines of ~/.gitk to change the fonts and/or sizes. Mine looks like this:


set mainfont {Helvetica 12}
set textfont {Courier 12}
set uifont {Helvetica 12 bold}
set tabstop 8
...

All this assumes that your X11 profile has a usable $PATH.

FinderColor: A Ruby interface to Finder labels in Mac OS X

I just posted to Rubyforge the first public version of FinderColor, a very small interface to the Finder label colors in Mac OS X. FinderColor sends Apple Events using rb-appscript, bypassing AppleScript entirely. This counts as a good thing.

Install: sudo gem install findercolor

There are only 5 methods to FinderColor:

 
  FinderColor.get_index(full_path_to_file)
  FinderColor.set_index(full_path_to_file, index)
  FinderColor.get_color(full_path_to_file)
  FinderColor.set_color(full_path_to_file, symbol)
  FinderColor.batch_set(hash)
 

The index argument must be between 0 and 7. The hash argument to batch_set expects the keys to be integers or symbols for color names. FinderColor::Labels gives you an array of the color symbols in their index order:

 
  FinderColor::Labels #=> [:none, :orange, :red, :yellow, :blue, :purple, :green, :gray ]
 

Rdocs here.

Managing PHP fastcgi with Launchd

Because I’m using PHPLDAPAdmin as a stopgap while I build a custom web directory application, I have gotten soiled a bit by PHP. I’m running everything on a headless Mac mini, and I chose to use Mac OS X as the OS for reasons I won’t go into here.

The front-end web server is nginx, which is proxying to php running as fcgi. Pardon me in advance if/when I get the terminology wrong. I tried using the instructions from the Homo Adminus blog, and while both the Bash script method and the spawn-fcgi method work, I could not figure out how to get launchd to manage them.

I hope that some of you are laughing at me at this point, because the problem was (and may still be) totally centered on my ignorance of the fastCGI usage of the php binary. I was being dense about launchd as well. Launchd doesn’t use spawn-fcgi or a custom shell script as the ProgramArguments. Rather, it completely obviates the need for them. This should have been obvious (a phrase that I promise will be common on this blog).

For the edification of the similarly ignorant, here’s a launchd plist that seems to work.

As I understand it, you set the server IP address and port number with the -b argument to the php binary. Homo Adminus adds the -q option (suppressing HTTP Header output) in his Bash script, so I did as well. To arrange for more than one listening process, you have to set the PHP_FCGI_CHILDREN environment variable.