<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>As Simple as Possible and No Simpler</title>
	<atom:link href="http://www.lincolnritter.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lincolnritter.com/blog</link>
	<description>Lincoln Ritter</description>
	<lastBuildDate>Thu, 10 Dec 2009 18:46:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Panoramas of Israel and Jordan</title>
		<link>http://www.lincolnritter.com/blog/2009/12/10/panoramas-of-israel-and-jordan/</link>
		<comments>http://www.lincolnritter.com/blog/2009/12/10/panoramas-of-israel-and-jordan/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 18:41:07 +0000</pubDate>
		<dc:creator>Lincoln</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.lincolnritter.com/blog/?p=37</guid>
		<description><![CDATA[I really love big pictures, especially panoramas.
These days, computer vision techniques like graph cuts, gradient-domain blending, and feature-based alignment make creating panoramas very easy.  Even using low-end equipment you can create pretty cool images.  On the viewing side of things, using image pyramids helps create really slick ways to view huge images.
To see [...]]]></description>
			<content:encoded><![CDATA[<p>I really love big pictures, especially panoramas.</p>
<p>These days, computer vision techniques like graph cuts, gradient-domain blending, and feature-based alignment make creating panoramas very easy.  Even using low-end equipment you can create pretty cool images.  On the viewing side of things, using image pyramids helps create really slick ways to view huge images.</p>
<p>To see what I mean, check out the <a href="http://lincolnritter.com/projects/israel_jordan/" >panoramas of Israel and Jordan</a> I created based on the photos I took on my recent trip to the Middle East.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lincolnritter.com/blog/2009/12/10/panoramas-of-israel-and-jordan/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting up DKIM and Domainkeys Email Signing with QMail</title>
		<link>http://www.lincolnritter.com/blog/2008/02/27/setting-up-dkim-and-domainkeys-email-signing-with-qmail/</link>
		<comments>http://www.lincolnritter.com/blog/2008/02/27/setting-up-dkim-and-domainkeys-email-signing-with-qmail/#comments</comments>
		<pubDate>Wed, 27 Feb 2008 20:50:10 +0000</pubDate>
		<dc:creator>Lincoln</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.lincolnritter.com/blog/2008/02/27/setting-up-dkim-and-domainkeys-email-signing-with-qmail/</guid>
		<description><![CDATA[Introduction
As you probably know, spam is a huge problem.  Not only is spam annoying and costly for receivers, the efforts to combat spam makes the lives of legitimate email senders difficult.
In recent years, a number of efforts have been made to help combat spam by introducing new mechanisms by which the identity of an [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>As you probably know, spam is a huge problem.  Not only is spam annoying and costly for receivers, the efforts to combat spam makes the lives of legitimate email senders difficult.</p>
<p>In recent years, a number of efforts have been made to help combat spam by introducing new mechanisms by which the identity of an email sender can be verified.  Among these are SPF (Sender Policy Framework)wikipedia-spf, SenderID, DomainKeys, and DKIM (DomainKeys Identified Mail). (See this <a href="http://en.wikipedia.org/wiki/E-mail_authentication" >general article on email authentication</a> for more details.)</p>
<p>QMail is a great Mail Transfer Agent.  It is very modular and &#8216;unixie&#8217; in that it is composed of several smaller programs that each do a single task and that are chained together to accomplish larger, end-to-end tasks.  One of the things that is nice about this is that modifying the behavior of QMail is often a matter of wrapping the relevant QMail component with a script that does some preprocessing or postprocessing before invoking the original component.</p>
<p>We are interested in making QMail do DomainKeys and DKIM signing of messages sent from our mail server.  There are a number of ways to do this.  One way involves patching and building parts of QMail.  This would be a good solution except that current patches don&#8217;t guarantee that <em>all</em> mail sent from the mail server will be signed and they only do DomainKeys signing.  Here, we adopt the wrapping approach.</p>
<h2>What this document covers</h2>
<p>This document is intended to help you set up outgoing email signing using DKIM/domainkeys under QMail on FreeBSD.  It does not cover the verification of DKIM/domainkey headers for received mail, although some of the references at the end of this article cover that.  I wrote this to document the steps I needed to take to get this working, and out of frustration that there didn&#8217;t seem to be a good comprehensive set of instructions out there that worked for me.</p>
<h2>Prerequisites</h2>
<p>This document assumes:</p>
<ul>
<li>You are running freebsd 6-ish</li>
<li>You have set up QMail according to the <a href="http://www.lifewithqmail.org/lwq.html#installation" >Life with QMail</a> instructions</li>
<li>
<p>You have installed OpenSSL</p>
<pre><code>$ cd /usr/ports/security/openssl; sudo make install clean
</code></pre>
</li>
<li>
<p>You have Perl installed</p>
</li>
<li>You have <a href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/linuxemu.html" >linux binary compatibility</a> installed and enabled and runtime libraries installed (not sure this is strictly necessary)</li>
<li>You have access to the DNS records for your domain and can modify them</li>
</ul>
<h2>Install &#8216;libdomainkeys&#8217;</h2>
<ol>
<li>
<p>Installing from ports doesn&#8217;t install the &#8216;dktest&#8217; program.  You need to build the library from source in order to get this (as far as I can tell anyway).</p>
<ol>
<li>Create a temporary location for your build, say &#8216;~/downloads&#8217;</li>
<li>Download the <a href="http://sourceforge.net/project/showfiles.php?group_id=107680" >libdomainkeys source</a> from sourceforge into your temporary location.  Extract the archive and enter the resulting directory.</li>
<li>
<p>Edit &#8216;Makefile&#8217;</p>
<p>The part in the original makefile that looks like</p>
<pre><code>UNAME := $(shell uname)
ifeq   ($(UNAME), SunOS)
       LIBS += -lsocket
endif

ifeq   ($(UNAME), UnixWare)
       CFLAGS += -DUNIXWARE
endif
</code></pre>
<p>should match</p>
<pre><code>#UNAME := $(shell uname)
#ifeq   ($(UNAME), SunOS)
#       LIBS += -lsocket
#endif
#
#ifeq   ($(UNAME), UnixWare)
#       CFLAGS += -DUNIXWARE
#endif
</code></pre>
<p>and the part that looks like</p>
<pre><code>(if $(MAKE) dnstest &gt;/dev/null 2&gt;&amp;1; then echo -lresolv; else echo ""; fi) &gt;dns.lib
</code></pre>
<p>should look like</p>
<pre><code>(if ! $(MAKE) dnstest &gt;/dev/null 2&gt;&amp;1; then echo -lresolv; else echo ""; fi) &gt;dns.lib
</code></pre>
</li>
<li>
<p>Build the dern thing</p>
<pre><code>$ make
</code></pre>
</li>
<li>
<p>Assuming the compilation worked, install the required files by:</p>
<pre><code>$ install -m 644 libdomainkeys.a /usr/local/lib/
$ install -m 644 domainkeys.h dktrace.h /usr/local/include/
$ install -m 755 dknewkey /usr/local/bin/
$ install -m 755 dktest /usr/local/bin/
</code></pre>
</li>
</ol>
</li>
</ol>
<h2>Install &#8216;Mail::DKIM&#8217;</h2>
<p>Note: This would be much easier using CPAN and the cpan shell, but I am not a Perl expert and don&#8217;t know how to install the &#8216;dkimsign.pl&#8217; and &#8216;dkimverify.pl&#8217; scripts using that method.</p>
<ol>
<li>Download the <a href="http://search.cpan.org/CPAN/authors/id/J/JA/JASLONG/Mail-DKIM-0.30.1.tar.gz" >Mail::DKIM package from CPAN</a> into your temporary location, extract it, and change to the resulting directory.</li>
<li>
<p>Issue the following commands:</p>
<pre><code> $ perl Makefile.PL
 $ make
 $ make test
 $ sudo make install
</code></pre>
</li>
<li>
<p>Patch dkimsign.pl to allow for keyfile parameter</p>
<p>You can apply this patch:</p>
<pre><code> --- dkimsign.pl.old    Thu Feb 28 11:26:46 2008
 +++ dkimsign.pl    Thu Feb 28 11:34:12 2008
 @@ -14,6 +14,7 @@
  use Getopt::Long;
  use Pod::Usage;

 +my $key_file = 'private.key'; # (lritter 01/23/2008): Added --key-file as a parameter to script
  my $type = "dkim";
  my $selector = "selector1";
  my $algorithm = "rsa-sha1";
 @@ -39,6 +40,7 @@
        "extra-tag=s" =&gt; \@extra_tag,
        "binary" =&gt; \$binary,
        "help|?" =&gt; \$help,
 +          "key-file=s" =&gt; \$key_file, # (lritter 01/23/2008): Added --key-file as a parameter to script
        )
    or pod2usage(2);
  pod2usage(1) if $help;
 @@ -61,7 +63,7 @@
        Algorithm =&gt; $algorithm,
        Method =&gt; $method,
        Selector =&gt; $selector,
 -      KeyFile =&gt; "private.key",
 +      KeyFile =&gt; $key_file, # (lritter 01/23/2008): Added --key-file as a parameter to script
        Debug_Canonicalization =&gt; $debugfh,
        );
</code></pre>
</li>
<li>
<p>Install &#8216;dkimsign.pl&#8217; and &#8216;dkimverify.pl&#8217;</p>
<pre><code>$ sudo install -m 755 scripts/dkimsign.pl /usr/local/bin/
$ sudo install -m 755 scripts/dkimverify.pl /usr/local/bin/
</code></pre>
</li>
</ol>
<h2>Create your key pair</h2>
<ol>
<li>
<p>Create the directory where you want your key pairs to reside</p>
<pre><code> $ sudo mkdir -p /etc/domainkeys/mail.example.com/
</code></pre>
</li>
<li>
<p>Create your key pair:</p>
<pre><code> $ sudo cd /etc/domainkeys/mail.example.com/
 $ sudo /usr/local/ssl/bin/openssl genrsa -out rsa.private 768
 $ sudo /usr/local/ssl/bin/openssl rsa -in rsa.private -out rsa.public -pubout -outform PEM
 $ sudo mv rsa.private default
</code></pre>
</li>
<li>
<p>Set the permissions of the keys directory and the public key</p>
<pre><code> $ sudo chown -R qmailq /etc/domainkeys
 $ sudo chgrp qmail default
 $ sudo chmod 0640 default
</code></pre>
<p>Note that the <code>chgrp</code> command is not in any docs or how-tos that I&#8217;ve seen but seems necessary for the &#8216;qmail-remote&#8217; program to access the file.  This is less than optimal as, if it&#8217;s only going to be accessed by &#8216;qmail-remote&#8217;, the permissions should reflect this.  I may try to revisit this at a later time.</p>
</li>
<li>
<p>Create the public key that will go in your DNS.</p>
<pre><code> $ grep -v ^- rsa.public | perl -e 'while(&lt;&gt;){chop;$l.=$_;}print "t=y; p=$l;\n";'
</code></pre>
<p>I&#8217;m going to refer to this as the &#8216;DNS-public-key&#8217;.</p>
</li>
</ol>
<h2>Create your DNS records</h2>
<p>The details on how to do this will vary depending on the system you use for DNS.  You want to create two TXT records for your domain.  For example:</p>
<pre><code>_domainkey.mail.example.com.  IN TXT  "t=y; o=-;"
default._domainkey.mail.example.com.  IN TXT  "DNS-public-key"
</code></pre>
<p>While your testing this, it&#8217;s a good idea to set the TTL for these to a pretty small number so you can make changes easily.</p>
<p>For and explanation of the DKIM/domainkeys DNS record syntax, see <a href="http://www.ietf.org/rfc/rfc4870.txt" >the DKIM RFC (4870)</a>, specifically pages 9 (and on) and 21 (and on).</p>
<h2>Wrap up &#8216;qmail-remote&#8217;</h2>
<ol>
<li>
<p>Go to your qmail bin directory:</p>
<pre><code> $ cd /var/qmail/bin
</code></pre>
</li>
<li>
<p>Move your existing &#8216;qmail-remote&#8217; out of the way:</p>
<pre><code> $ sudo mv qmail-remote qmail-remote.orig
</code></pre>
</li>
<li>
<p>Create a file called &#8216;qmail-remote-wrapper.sh&#8217; with the following contents (taken from <a href="http://www.memoryhole.net/qmail/#dkim" >memoryhole</a>):</p>
<pre><code> #!/usr/local/bin/bash
 DOMAIN="mail.example.com"
 DKREMOTE="/var/qmail/bin/qmail-remote.orig"
 DKSIGN="/etc/domainkeys/$DOMAIN/default"
 tmp=`/usr/bin/mktemp -t dk.sign.XXXXXXXXXXXXXXXXXXX`
 /bin/cat - &gt;"$tmp"
 ( /usr/local/bin/dktest -s "$DKSIGN" -c nofws -h &lt;"$tmp" 2&gt;/dev/null | \
     /usr/bin/sed 's/; d=.*;/; d='"$DOMAIN"';/' ;
     /usr/local/bin/dkimsign.pl --type=dkim --selector=default \
         --key-file="$DKSIGN" --method=relaxed &lt;"$tmp" | \
         /usr/bin/tr -d '\r' ;
     /bin/cat "$tmp" ) | \
         "$DKREMOTE" "$@"
 retval=$?
 /bin/rm "$tmp"
 exit $retval
</code></pre>
<p>Make sure that you change <code>DOMAIN</code> to match your domain, <code>DKREMOTE</code> to match the name/path of the original qmail-remote program that you moved in the last step, and <code>DKSIGN</code> to match the location of the keys created in the section &#8216;Create your key pair&#8217;.</p>
</li>
<li>
<p>Make the wrapper executable:</p>
<pre><code> $ sudo chmod a+x qmail-remote-wrapper.sh
</code></pre>
</li>
<li>
<p>Link the wrapper to &#8216;qmail-remote&#8217;</p>
<pre><code> $ sudo ln -s qmail-remote-wrapper.sh qmail-remote
</code></pre>
</li>
</ol>
<h2>Testing your email signing</h2>
<ol>
<li>
<p>Go to <a href="http://www.deliverability.com/resources/emailAuthentication.php" >authentication section of deliverability.com</a>.  At the bottom of the page, you will find a randomly generated email address that looks like:<br />
     XXxXXxXX@www.deliverability.com</p>
<p>I will refer to this as the &#8216;test-address&#8217;.</p>
</li>
<li>
<p>Create a temporary folder for testing purposes, say:</p>
<pre><code> $ mkdir ~/email_testing
</code></pre>
</li>
<li>
<p>In the testing folder, create a file called &#8216;deliverability.com_test_message&#8217; with the following content:</p>
<pre><code> to:test-address
 from: some-user@mail.example.com
 subject: test message

 This is a test.
</code></pre>
</li>
<li>
<p>Send the test message:</p>
<pre><code> $ cat ~/email_testing/deliverability.com_test_message | /var/qmail/bin/qmail-inject
</code></pre>
</li>
<li>
<p>Go to the <a href="http://www.deliverability.com/resources/emailAuthentication.php" >authentication section of deliverability.com</a> and submit the &#8216;test-address&#8217; (the one you just sent to) with the form at the bottom of the page.</p>
<p>You should see a check mark under the &#8216;DomainKey&#8217; heading. Note that if you look closely you will notice that the website says &#8220;DKIM-Status: Unrecognized version 1&#8243;.  This is incorrect.  The RFC clearly states that the &#8216;v&#8217; flag MUST be set to &#8216;1&#8242;.  The verifier is not DKIM compliant.  For the most part DKIM is even less prevalent than DomainKeys (though there seems to be a consensus that DKIM is the way of the future&#8230;).</p>
</li>
</ol>
<h2>Tips</h2>
<ul>
<li>
<p>You can view your qmail log while your testing with:</p>
<pre><code>$ tail -f /var/log/qmail/current
</code></pre>
</li>
<li>
<p>&#8216;dk@dk.crynwr.com&#8217; forwards email to it to a number of verification services that end mail back to the sending account.</p>
</li>
</ul>
<h2>References</h2>
<ul>
<li><a href="http://www.lifewithqmail.org/lwq.html#installation" >Life with qmail</a></li>
<li><a href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/linuxemu.html" >FreeBSD Linux compatability</a></li>
<li><a href="http://sourceforge.net/project/showfiles.php?group_id=107680" >libdomainkeys</a></li>
<li><a href="http://search.cpan.org/CPAN/authors/id/J/JA/JASLONG/Mail-DKIM-0.30.1.tar.gz" >Mail::DKIM</a></li>
<li><a href="http://qmail.jms1.net/patches/domainkeys.shtml" >John M. Simpson&#8217;s page on DomainKeys and QMail</a></li>
<li><a href="http://forum.qmailrocks.org/showthread.php?t=6099" >Relevant QMailRocks forum thead</a></li>
<li><a href="http://www.ietf.org/rfc/rfc4870.txt" >DKIM RFC</a></li>
<li><a href="http://www.memoryhole.net/qmail/#dkim" >The qmail-remote wrapper script</a></li>
<li><a href="http://www.deliverability.com/resources/emailAuthentication.php" >deliverability.com authentication page</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.lincolnritter.com/blog/2008/02/27/setting-up-dkim-and-domainkeys-email-signing-with-qmail/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Leopard, PostgreSQL and PostGIS from KyngChaos.com</title>
		<link>http://www.lincolnritter.com/blog/2007/12/04/leopard-postgresql-and-postgis-from-kyngchaoscom/</link>
		<comments>http://www.lincolnritter.com/blog/2007/12/04/leopard-postgresql-and-postgis-from-kyngchaoscom/#comments</comments>
		<pubDate>Wed, 05 Dec 2007 06:41:21 +0000</pubDate>
		<dc:creator>Lincoln</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.lincolnritter.com/blog/2007/12/04/leopard-postgresql-and-postgis-from-kyngchaoscom/</guid>
		<description><![CDATA[In my last post I detailed my process for building PostgreSQL and PostGIS on Leopard.  Problem is, it didn&#8217;t work.  I was getting a strange crash when importing shape data.  I&#8217;m not positive what the problem is but I would bet it was the liconv trickery&#8230;
In any case, I discovered that there [...]]]></description>
			<content:encoded><![CDATA[<p>In my last post I detailed my process for building PostgreSQL and PostGIS on Leopard.  Problem is, it didn&#8217;t work.  I was getting a strange crash when importing shape data.  I&#8217;m not positive what the problem is but I would bet it was the liconv trickery&#8230;</p>
<p>In any case, I discovered that there are pre-built binaries for OS-X (Leopard compatible!) referenced from the <a href="http://www.postgis.org/download/" >PostGIS website</a>.  The maintainer has also packaged some <a href="http://www.kyngchaos.com/wiki/software:frameworks" >require frameworks</a> (GEOS and PROJ).</p>
<p>I&#8217;ve now got everything working (<em>I think</em>!) using the pre-compiled binaries.  The steps are somewhat similar to those detailed in the other post.  Here&#8217;s what I did:</p>
<h2>PostgreSQL</h2>
<ul>
<li>Download the PostgreSQL dmg and run the installer. (I also installed the startup item)</li>
</ul>
<h2>PostGIS</h2>
<ul>
<li>Download the GEOS and PROJ images and run the installers.</li>
<li>Download the PostGIS dmg and run the installer</li>
</ul>
<h2>Initial DB Setup</h2>
<ul>
<li>Initialize the default db. (The installer readme says that it does this but it didn&#8217;t seem to&#8230;)<br />
<code>$ sudo su postgres -c '/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data'</code></li>
<li>Create a new superuser:<br />
<code>$ createdb -U postgres &lt;user-name&gt;</code></li>
<li>
<p>Create a postgis template database:</p>
<ul>
<li>
<p>Connect to the template database<br />
<code>$ psql template1</code></p>
<ul>
<li>
<p>Execute the following commands:<br />
<code>template1=# create database template_postgis with template = template1;</code><br />
<code>template1=# UPDATE pg_database SET datistemplate = TRUE where datname = 'template_postgis';</code></p>
</li>
<li>
<p>Connect to the new template_postgis database:<br />
<code>template1=# c template_postgis</code></p>
</li>
<li>
<p>Add PostGIS extensions and grant access to everyone to spatial tables:<br />
<code>template_postgis=# CREATE LANGUAGE plpgsql;</code><br />
<code>template_postgis=# i /usr/local/pgsql/share/lwpostgis.sql;</code><br />
<code>template_postgis=# i /usr/local/pgsql/share/spatial_ref_sys.sql;</code><br />
<code>template_postgis=# GRANT ALL ON geometry_columns TO PUBLIC;</code><br />
<code>template_postgis=# GRANT ALL ON spatial_ref_sys TO PUBLIC;</code></p>
</li>
<li>
<p>Prevent further modifications to the template_postgis database:<br />
<code>template_postgis=# VACUUM FREEZE;</code></p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2>Ruby</h2>
<ul>
<li>Install postgres nativ extensions
<ul>
<li>Get the gem sources<br />
<code>$ sudo gem install postgres</code></li>
<li>The build will fail.  Go to <code>/usr/lib/ruby/user-gems/1.8/gems/postgres-0.7.1</code> and execute:<br />
<code>$ sudo ruby extconf.rb --with-pgsql-dir=/usr/local/pgsql/</code><br />
<code>$ sudo make &amp;&amp; sudo make install</code><br />
<code>$ sudo gem install postgres</code></li>
</ul>
</li>
<li>Install GeoRuby<br />
<code>$ sudo gem install GeoRuby</code></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.lincolnritter.com/blog/2007/12/04/leopard-postgresql-and-postgis-from-kyngchaoscom/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Installing PostgreSQL, PostGIS and more on OS-X Leopard</title>
		<link>http://www.lincolnritter.com/blog/2007/12/04/installing-postgresql-postgis-and-more-on-os-x-leopard/</link>
		<comments>http://www.lincolnritter.com/blog/2007/12/04/installing-postgresql-postgis-and-more-on-os-x-leopard/#comments</comments>
		<pubDate>Tue, 04 Dec 2007 21:57:35 +0000</pubDate>
		<dc:creator>Lincoln</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.lincolnritter.com/blog/2007/12/04/installing-postgresql-postgis-and-more-on-os-x-leopard/</guid>
		<description><![CDATA[Getting my web development stack back in order after upgrading to Leopard has been a little hit-or-miss.  Now, in preparation for some geocoding work, I&#8217;m adding PostgreSQL and PostGIS to the mix.  Here&#8217;s what I had to do to get stuff working.  I haven&#8217;t tested it extensively yet, but I&#8217;ll update this [...]]]></description>
			<content:encoded><![CDATA[<p>Getting my web development stack back in order after upgrading to Leopard has been a little hit-or-miss.  Now, in preparation for some geocoding work, I&#8217;m adding PostgreSQL and PostGIS to the mix.  Here&#8217;s what I had to do to get stuff working.  I haven&#8217;t tested it extensively yet, but I&#8217;ll update this post as necessary.</p>
<p><strong>Update:</strong> I&#8217;m getting some strange bus errors from PostgreSQL (signal 10)&#8230; I&#8217;d eventually like to get the ports method working, but for now, I&#8217;m going to use the <a href="http://www.kyngchaos.com/software/unixport/postgres"  title="prepackaged_binaries">prepackaged binaries</a>.  Also of note <a href="http://www.kyngchaos.com/wiki/software:frameworks"  title="require_frameworks">these required ported frameworks</a>.</p>
<h2>PostgreSQL</h2>
<ul>
<li>
<p>Install PostgreSQL<br />
<code>$ sudo port -k install postgresql82 postgresql82-server</code><br />
(&#8217;-k&#8217; doesn&#8217;t do cleanup&#8230; just in case I want the work files later in the install process)</p>
</li>
<li>
<p>Make the default DB directory, set the owner to the postgres user, and initialize the DB<br />
<code>$ sudo mkdir -p /opt/local/var/db/postgresql82/defaultdb</code><br />
<code>$ sudo chown postgres:postgres /opt/local/var/db/postgresql82/defaultdb</code><br />
<code>$ sudo su postgres -c '/opt/local/lib/postgresql82/bin/initdb -D /opt/local/var/db/postgresql82/defaultdb'</code><br />
(you could replace &#8216;postgres&#8217; with something else if you want another user to be the postgres user)</p>
</li>
<li>
<p>Add PostgreSQL server as a startup item<br />
<code>$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql82-server.plist</code><br />
(add startup info)</p>
</li>
<li>
<p>Add PostgreSQL executables to your path:<br />
<code>$ PATH=${PATH}:/opt/local/lib/postgresql82/bin</code></p>
</li>
<li>
<p>Create a DB user<br />
<code>$ createuser -U postgres -s -P -E &lt;name-of-superuser&gt;</code><br />
(If you set the postgres user to something other that &#8216;postgres&#8217; that should be reflected above.)</p>
</li>
</ul>
<h2>PostGIS</h2>
<ul>
<li>
<p>Update the ports system<br />
<code>$ sudo port selfupdate</code></p>
</li>
<li>
<p>Navigate to the location of the PostGIS portfile<br />
<code>$ /opt/local/var/macports/sources/rsync.macports.org/release/ports/databases/postgis</code></p>
</li>
<li>
<p>Change the line in the portfile that reads:</p>
<blockquote>
<p>build.args &#8220;ICONV_LDFLAGS=\&#8221;-L${prefix}/lib -liconv\&#8221;"</p>
</blockquote>
<p>to</p>
<blockquote>
<p>build.args &#8220;ICONV_LDFLAGS=\&#8221;-L$/usr/lib -liconv\&#8221;"</p>
</blockquote>
<p>(OS-X already has the iconv library and I believe this will work fine.  Using the ports version breaks.)</p>
</li>
<li>
<p>Run the port installation procedure<br />
<code>$ sudo port -k install postgis</code><br />
(without &#8216;-k&#8217; in this case, the port will break before finishing instal)</p>
</li>
</ul>
<h3>Creating a PostGIS template</h3>
<p>The following is adapted from <a href="http://waage.sr.unh.edu/~braswell/blog/?p=49"  title="rob_braswells_instructions">Rob Braswell&#8217;s instructions</a>.  This allows non-superusers to create spatial databases using a template.</p>
<ul>
<li>
<p>Connect to the template database<br />
<code>$ psql template1</code></p>
</li>
<li>
<p>Execute the following commands:<br />
<code>template1=# create database template_postgis with template = template1;</code><br />
<code>template1=# UPDATE pg_database SET datistemplate = TRUE where datname = 'template_postgis';</code></p>
</li>
<li>
<p>Connect to the new template_postgis database:<br />
<code>template1=# \c template_postgis</code></p>
</li>
<li>
<p>Add PostGIS extensions and grant access to everyone to spatial tables:<br />
<code>template_postgis=# CREATE LANGUAGE plpgsql;</code><br />
<code>template_postgis=# \i /opt/local/share/postgis/lwpostgis.sql;</code><br />
<code>template_postgis=# \i /opt/local/share/postgis/spatial_ref_sys.sql;</code><br />
<code>template_postgis=# GRANT ALL ON geometry_columns TO PUBLIC;</code><br />
<code>template_postgis=# GRANT ALL ON spatial_ref_sys TO PUBLIC;</code></p>
</li>
<li>
<p>Prevent further modifications to the template_postgis database:<br />
<code>template_postgis=# VACUUM FREEZE;</code></p>
</li>
<li>
<p>Quit out of psql (<code>^D</code> or <code>\q</code>)</p>
</li>
<li>
<p>Create a test database using the new template_postgis template&#8230;<br />
<code>$ createdb test_gis_db -T template_postgis</code><br />
&#8230;and drop it again.<br />
<code>$ dropdb test_gis_db</code></p>
</li>
</ul>
<h2>Cleanup PostgreSQL/PostGIS installation files</h2>
<ul>
<li>Let&#8217;s get rid of the work files associated with the installation above:<br />
<code>$ sudo port clean postgresql82 postgresql82-server postgis</code></li>
</ul>
<h2>Ruby and Rails</h2>
<ul>
<li>
<p>Install Ruby library for PostgreSQL<br />
<code>$ sudo gem install postgres</code></p>
</li>
<li>
<p>Install GeoRuby<br />
<code>$ sudo gem install georuby</code></p>
</li>
</ul>
<p>Take a look at this <a href="http://ym4r.rubyforge.org/tutorial_ym4r_georuby.html"  title="georuby_and_rails_tutorial">GeoRuby and Rails tutorial</a> for more rails integration info.  I&#8217;ll update this post once i get to that stage.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lincolnritter.com/blog/2007/12/04/installing-postgresql-postgis-and-more-on-os-x-leopard/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>The Price of a Yo-yo</title>
		<link>http://www.lincolnritter.com/blog/2006/11/20/the-price-of-a-yo-yo/</link>
		<comments>http://www.lincolnritter.com/blog/2006/11/20/the-price-of-a-yo-yo/#comments</comments>
		<pubDate>Tue, 21 Nov 2006 03:48:18 +0000</pubDate>
		<dc:creator>Lincoln</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.lincolnritter.com/blog/2006/11/20/the-price-of-a-yo-yo/</guid>
		<description><![CDATA[I just heard a pretty interesting tidbit (Battling the AK-47 ) over on marketplace.org.  It was about the AK-47.  The history of the weapon seems pretty interesting (weapon of choice of the bad guys, largely distributed by the good guys) but what i thought was really interesting is how organizations like Medicines Sans [...]]]></description>
			<content:encoded><![CDATA[<p>I just heard a pretty interesting tidbit (<a href="http://marketplace.publicradio.org/shows/2006/11/20/PM200611204.html" >Battling the AK-47</a> ) over on marketplace.org.  It was about the <a href="http://en.wikipedia.org/wiki/Ak-47" >AK-47</a>.  The history of the weapon seems pretty interesting (weapon of choice of the bad guys, largely distributed by the good guys) but what i thought was really interesting is how organizations like Medicines Sans Frontiers sometimes use the price of AKs to determine the level of violence in a particular area.  Could be another application of futures markets used for prediction: a weapons futures market as a measure of social unrest&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lincolnritter.com/blog/2006/11/20/the-price-of-a-yo-yo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best Dominos Ever</title>
		<link>http://www.lincolnritter.com/blog/2006/09/19/best-dominos-ever/</link>
		<comments>http://www.lincolnritter.com/blog/2006/09/19/best-dominos-ever/#comments</comments>
		<pubDate>Wed, 20 Sep 2006 00:49:15 +0000</pubDate>
		<dc:creator>Lincoln</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.lincolnritter.com/blog/2006/09/19/best-dominos-ever/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><ins><div class='quickTimeVideo_link'><a href="javascript:qt_openWindow('http://mnstories.com/video/mnstories_20060918.mov" )" onmouseover="window.status='View This Video Full Screen';return true" onmouseout="window.status='';return true">View This Video Full Screen</a></div><div class='quickTimeVideo_holder' style='display:none;' id ='qtHolder_2'><div style='height:350px;' class='quickTimeVideo'><object width='425' height='350' classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' codebase='http://www.apple.com/qtactivex/qtplugin.cab'><param name='src' value='http://mnstories.com/video/mnstories_20060918.mov'/><param name='autplay' value='true'/><param name='controller' value='true'/><param name='scale' value='Aspect'/><object type='video/quicktime' data='http://mnstories.com/video/mnstories_20060918.mov' width='425' height='350' class='gv_mov'><param name='autplay' value='true'/><param name='controller' value='true'/><param name='scale' value='Aspect'/></object></object></div></div></ins><ins><div style='height:350px;width:425px;' class='quickTimeVideo_holder' id='qtProxy_2' onclick="gv_switchOn('qtHolder_2','qtProxy_2')">
				<div style='height:350px;text-align:center' class='quickTimeVideo'>
					<table style='width:425px;height:350px' cellpadding='0' cellspacing='0' border='0'>
						<tr>
							<td align='center' valign='middle'>
							<img src='http://developer.apple.com/softwarelicensing/agreements/images/logo_qtlogo.gif'style='border:0px' alt='Quick Time Logo'/><br />
							<b>Click Here to View the QuickTime Movie</b>
							</td>
						</tr>
					</table>
				</div>
				</div></ins></p>
<p>But what if you don&#8217;t have a crapload of dominos?  No problem, just use CD&#8217;s, or, um, toast.</p>
<p><ins><div class='yourTubeVideo_link'><a href="http://www.youtube.com/watch?v=7376F0QHSug" >View This Video on You Tube</a></div><div class='yourTubeVideo_holder'><div style='height:350px;' class='yourTubeVideo'><object style='width:425px;height:350px' type='application/x-shockwave-flash' data='http://www.youtube.com/v/7376F0QHSug'><param name='movie' value='http://www.youtube.com/v/7376F0QHSug'/><param name='scale' value='noScale' /><param name='wmode' value='window'/><param name='salign' value='TL' /></object></div></div></ins></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lincolnritter.com/blog/2006/09/19/best-dominos-ever/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://mnstories.com/video/mnstories_20060918.mov" length="11059782" type="video/quicktime" />
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.064 seconds -->
<!-- Cached page served by WP-Cache -->
