Making Postgresql82 run under leopard (from Mac Ports)

Posted by Roy Hooper Sat, 08 Mar 2008 19:42:00 GMT

After installing the Mac Ports postgresql82-server port, I tried to make it run. It didn’t. The problem was that su didn’t like running anything as user postgres. Here’s the original instructions:

###########################################################
# A startup item has been generated that will aid in
# starting postgresql82-server with launchd. It is disabled
# by default. Execute the following command to start it,
# and to cause it to launch at startup:
#
# sudo launchctl load -w  /Library/LaunchDaemons/org.macports.postgresql82-server.plist 
###########################################################  
--->  Installing postgresql82-server 8.2.6_0

To create a database instance, after install do
 sudo mkdir -p /opt/local/var/db/postgresql82/defaultdb
 sudo chown postgres:postgres  /opt/local/var/db/postgresql82/defaultdb 
 sudo su postgres -c '/opt/local/lib/postgresql82/bin/initdb -D  /opt/local/var/db/postgresql82/defaultdb'
And here’s my test to determine if su was working:
 sudo su postgres -c id
I got no output… So I tried
 sudo -u postgres id
And I get:
 uid=401(postgres) gid=401(postgres) groups=401(postgres)
So now what?

There’s an easy way to deal with this: Grab the server admin tools from Apple and install them.

Next, fire up Workgroup Manager (its in your /Applications/Server folder). Ignore the dialog and go straight to the menu and select Server -> View Directories. Select the PostgreSQL Server user in the left-hand pane, then select the Advanced tab and change the Login Shell to something like /bin/sh. See the picture for details. Don’t forget to hit Save.

Now the command from before works:

# sudo su postgres -c id
uid=401(postgres) gid=401(postgres) groups=401(postgres)
So now we can finish the last step to initialize the database, then fire up Postgres.
  sudo su postgres -c '/opt/local/lib/postgresql82/bin/initdb -D /opt/local/var/db/postgresql82/defaultdb'

If you already ran the launchctl command, you can make Postgres start with these two commands:

 sudo launchctl unload -w /Library/LaunchDaemons/org.macports.postgresql82-server.plist
 sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql82-server.plist

Otherwise just run the load version of the command.

RMagick on OSX

Posted by Roy Hooper Mon, 19 Feb 2007 00:22:00 GMT

You’d think that installing rmagick on OSX would just work if you’re a fink user and use the gem.

You’d be dead wrong, unfortunately. Like I was.

Instead, you should use Darwin Ports and manually build ImageMagick/RMagick.

Fortunately there’s some really easy to follow instructions here: http://rmagick.rubyforge.org/install-osx.html

The error I was encountering occurred when I tried:

require_gem 'rmagick'
require 'RMagick'
Magick
in irb. The Magick bit failed telling me: NameError: uninitialized constant Magick. After the above, I can skip the require_gem part, and go straight to it:
require 'RMagick'

Intel C Compiler for OSX

Posted by Roy Hooper Mon, 19 Feb 2007 00:20:00 GMT

One of these days, I have to get an eval of the Intel C compiler for OSX and try it out. I’d like to see just how much faster code generated by it is than code generated by GCC.

Check it out here