Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

PostgreSQL shared memory

// description of your code here

PostgreSQL 8.1.x/8.2.x works nicely on Leopard but you do have to alter some system settings.

In Mac OS X 10.3 and up you have to increase the shared memory of your system to be able to run PostgreSQL with more connections and be faster in general.
You had to go into /etc/rc and look for similar lines and changing the values accordingly

sysctl -w kern.sysv.shmmax=167772160
sysctl -w kern.sysv.shmmin=1
sysctl -w kern.sysv.shmmni=32
sysctl -w kern.sysv.shmseg=8
sysctl -w kern.sysv.shmall=65536


But in Leopard /etc/rc doesn't exist anymore. You now have to create or open /etc/sysctl.conf
Add the following lines to it:=

kern.sysv.shmmax=167772160
kern.sysv.shmmin=1
kern.sysv.shmmni=32
kern.sysv.shmseg=8
kern.sysv.shmall=65536

Manually Starting & Stopping MySQL in Leopard

This is for software built from source according to:
http://hivelogic.com/articles/installing-mysql-on-mac-os-x/

Start MySQL
sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysqld.plist


Stop MySQL
sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysqld.plist


Run Apache in 32bit mode on Leopard

There is currently an issue resulting from the fact that Apache on Mac OS X 10.5 is built as a 64 bit application. On Macs that support 64 bits (all current Mac models), Apache will run in 64 bit mode. This is incompatible with most ODBC drivers, including those currently available from Actual Technologies.
Until we can make 64 bit versions of our drivers available, we recommend a workaround to force Apache to run in 32 bit mode. Using the Terminal prompt, enter the following commands (this is for ppc machines, for intel switch ppc7400 to i386):
sudo mv /usr/sbin/httpd /usr/sbin/httpd.ub

sudo lipo -thin ppc7400 /usr/sbin/httpd.ub -output /usr/sbin/httpd.ppc7400

sudo ln -s /usr/sbin/httpd.ppc7400 /usr/sbin/httpd 

Now restart Web Sharing in the System Preferences, and continue with the instructions for "Invoking ODBC Functions from ODBC" below.
NOTE: if you ever need to restore Apache to 64 bit mode, just enter the following command:
sudo mv /usr/sbin/httpd.ub /usr/sbin/httpd

Starting and stopping MySQL on leopard.

#starting SQL:
sudo /usr/local/mysql/support-files/mysql.server start

Stoping SQL:
sudo /usr/local/mysql/support-files/mysql.server stop

lighttpd launchd script for Leopard

This script solves the excessive re-spawning problem that surfaces with Tiger-era launchd scripts. Tested using Lighttpd 1.4.18 and OS X 10.5.1.

Obviously, you may need to point to /usr/local/bin/lighttpd-start if you installed with --prefix=/usr/local

Put this at: /Library/LaunchDaemons/net.lighttpd.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>net.lighttpd</string>
	<key>ProgramArguments</key>
	<array>
	    <string>/usr/bin/lighttpd-start</string>
	</array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>