<?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>Blog - ShiftEleven &#187; postgresql</title>
	<atom:link href="http://shifteleven.com/articles/tag/postgresql/feed" rel="self" type="application/rss+xml" />
	<link>http://shifteleven.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sat, 19 Sep 2009 11:19:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0-alpha</generator>
		<item>
		<title>Installing PostgreSQL on Leopard using MacPorts</title>
		<link>http://shifteleven.com/articles/2008/03/21/installing-postgresql-on-leopard-using-macports</link>
		<comments>http://shifteleven.com/articles/2008/03/21/installing-postgresql-on-leopard-using-macports#comments</comments>
		<pubDate>Sat, 22 Mar 2008 03:41:36 +0000</pubDate>
		<dc:creator>K. Adam Christensen</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[leopard]]></category>
		<category><![CDATA[macports]]></category>
		<category><![CDATA[pgadmin3]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://shifteleven.com/?p=43</guid>
		<description><![CDATA[I have always used MySQL but I wanted to give PostgreSQL a whirl.  This is what I did.

Prerequisites
Now I don&#8217;t want to go too deep into this, so I&#8217;m going to assume that if you are reading this, that you have the following installed

Mac OS Developer&#8217;s Tools
MacPorts
Ruby (comes with Leopard)

Ruby Gems (also comes with [...]]]></description>
			<content:encoded><![CDATA[<p>I have always used <a href="http://www.mysql.com/,">MySQL</a> but I wanted to give <a href="http://www.postgresql.org/">PostgreSQL</a> a whirl.  This is what I did.</p>
<p><span id="more-43"></span></p>
<h3>Prerequisites</h3>
<p>Now I don&#8217;t want to go too deep into this, so I&#8217;m going to assume that if you are reading this, that you have the following installed</p>
<ul>
<li><a href="http://developer.apple.com/tools/">Mac OS Developer&#8217;s Tools</a></li>
<li><a href="http://www.macports.org/install.php">MacPorts</a></li>
<li><a href="http://www.ruby-lang.org/">Ruby</a> (comes with Leopard)
<ul>
<li><a href="http://www.rubygems.org/">Ruby Gems</a> (also comes with Leopard)</li>
</ul>
</li>
</ul>
<p>So now that you have all of those dependencies out of the way, let&#8217;s get to installing us some PostgreSQL.</p>
<h3>PostgreSQL</h3>
<p>To install the database software, simply run the following command in <a href="http://www.apple.com/macosx/technology/unix.html">Terminal</a></p>
<pre>sudo port install \
  postgresql83 \
  postgresql83-server</pre>
<p>This will install the client and server needed for you to run this on your machine.  Now pay special attention to the installation script.  At the end of installation processes, macports will display a message for you that contains some commands for you to get started with.</p>
<h4>Configuration</h4>
<p>First, execute these lines of code.  This will setup a new database for you to play with</p>
<pre>sudo mkdir -p /opt/local/var/db/postgresql83/defaultdb
sudo chown postgres:postgres /opt/local/var/db/postgresql83/defaultdb
sudo su postgres -c '/opt/local/lib/postgresql83/bin/initdb -D /opt/local/var/db/postgresql83/defaultdb'</pre>
<h4>Start PostgreSQL Automatically</h4>
<p>By running the next command, you can have PostgreSQL lunch automatically so that it&#8217;s always available to you</p>
<pre>sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql83-server.plist</pre>
<h3>pgAdmin III</h3>
<p><a href="http://www.pgadmin.org/">pgAdmin III</a> is a PostgreSQL management and administrations piece of software.  It&#8217;s a nice GUI to some things that you may find yourself wanting to do, like created databases and whatnot.  Installation of this is pretty cake.</p>
<pre>sudo port install pgAdmin3</pre>
<p>Upon completion of installation, you can find the application in <code>/Applications/MacPorts/pgAdmin3</code></p>
<h3>PostgreSQL Libraries for Ruby via Gems</h3>
<p>I have to admit, the previous installation steps were nothing to cry about; however, it was this step that made me want to put together this little walkthrough.</p>
<pre>sudo env ARCHFLAGS="-arch i386" \
  gem install postgres -- \
  --with-pgsql-lib=/opt/local/lib/postgresql83 \
  --with-pgsql-include=/opt/local/include/postgresql83</pre>
<p>That&#8217;s not exactly your everyday <code>gem install</code> command.  For one, the environment variable <code>ARCHFLAGS</code> has to be set.  Secondly, the <code>gem</code> command needs to know where the PostgreSQL  libraries and include headers are so that it can compile.  Looking back, it&#8217;s actually quite easy to copy and paste that command, it just took me a while to find out exactly what I needed to make it work.</p>
<h3>Fin</h3>
<p>Well, I hope that helps anyone looking to install and setup PostgreSQL in Leopard.  Until next time&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://shifteleven.com/articles/2008/03/21/installing-postgresql-on-leopard-using-macports/feed</wfw:commentRss>
		<slash:comments>42</slash:comments>
		</item>
	</channel>
</rss>
