diff -Nurd postgresql-9.3.4/pgsql.sh postgresql-9.3.4-patched/pgsql.sh
--- postgresql-9.3.4/pgsql.sh	1969-12-31 19:00:00.000000000 -0500
+++ postgresql-9.3.4-patched/pgsql.sh	2014-04-17 10:13:22.000000000 -0400
@@ -0,0 +1,83 @@
+#!/bin/sh
+
+die () {
+	echo "failed"
+	echo ""
+	echo "*** bailing because an error ocurred:"
+	echo ""
+	echo "$*"
+	exit 1
+}
+
+PREFIX="@INSTPREFIX@/opt/postgresql-@PGVERSION@"
+DATADIR="@INSTPREFIX@/var/postgresql-@PGVERSION@/data"
+LOGFILE="@INSTPREFIX@/var/postgresql-@PGVERSION@/pgsql.log"
+
+export LANG=C
+unset LC_ALL
+
+export PATH="$PREFIX/bin:@INSTPREFIX@/bin:$PATH"
+
+SHMMAX=`sysctl kern.sysv.shmmax | cut -d' ' -f2-`
+SHMMNI=`sysctl kern.sysv.shmmni | cut -d' ' -f2-`
+SHMALL=`sysctl kern.sysv.shmall | cut -d' ' -f2-`
+
+if [ "$SHMMAX" -lt "8388608" ] || [ "$SHMMNI" -lt "64" ] || [ "$SHMALL" -lt "32768" ]; then
+	echo "WARNING: You probably need to set your shared memory resources higher for"
+	echo "         PostgreSQL to function.  For more information on raising your shared"
+	echo "         memory settings, see:"
+	echo "         http://wiki.finkproject.org/index.php/Shared_Memory_Regions_on_Darwin"
+	echo ""
+	echo "         I am also creating a default configuration in /etc/sysctl.conf.pg"
+	echo "         that contains values that will work with the default PostgreSQL "
+	echo "         memory settings.  To use it, rename it to /etc/sysctl.conf (if you"
+	echo "         don't have one already) and reboot."
+	echo ""
+	echo "         For now, I'll try setting your sysctl to something higher and then"
+	echo "         running things anyways.  Good luck!  =)"
+	echo ""
+	sysctl -w kern.sysv.shmmax=8388608
+	sysctl -w kern.sysv.shmmin=1
+	sysctl -w kern.sysv.shmmni=64
+	sysctl -w kern.sysv.shmseg=8
+	sysctl -w kern.sysv.shmall=32768
+	echo ""
+	cat <<END >/etc/sysctl.conf.pg
+kern.sysv.shmmax=8388608
+kern.sysv.shmmin=1
+kern.sysv.shmmni=64
+kern.sysv.shmseg=8
+kern.sysv.shmall=32768
+END
+fi
+
+if [ ! -d "$DATADIR" ]; then
+	printf -- "- making postgresql directories: "
+	sudo mkdir -p "$DATADIR"
+	sudo chown -R postgres "$DATADIR/.."
+	echo "ok"
+
+	printf -- "- initializing database in $DATADIR: "
+	sudo -u postgres ${PREFIX}/bin/initdb -E UNICODE -D "$DATADIR" >/tmp/pgsql-init-@PGVERSION@.log 2>&1 || die "couldn't initialize database"
+	echo "ok"
+fi
+
+PG_COMMAND="sudo -u postgres env"
+if [ -n "$PGPORT" ]; then
+	PG_COMMAND="$PG_COMMAND PGPORT=$PGPORT"
+fi
+PG_COMMAND="$PG_COMMAND ${PREFIX}/bin/pg_ctl"
+
+case "$1" in
+	init)
+		;;
+	start)
+		$PG_COMMAND -D "$DATADIR" -l "$LOGFILE" start
+		;;
+	restart)
+		$PG_COMMAND -D "$DATADIR" -m fast restart
+		;;
+	stop)
+		$PG_COMMAND -D "$DATADIR" -m fast stop
+		;;
+esac
diff -Nurd postgresql-9.3.4/src/Makefile.global.in postgresql-9.3.4-patched/src/Makefile.global.in
--- postgresql-9.3.4/src/Makefile.global.in	2014-03-17 15:35:47.000000000 -0400
+++ postgresql-9.3.4-patched/src/Makefile.global.in	2014-04-17 10:14:14.000000000 -0400
@@ -203,7 +203,7 @@
 
 # Compilers
 
-CPP = @CPP@
+CPP = $(CC) -E
 CPPFLAGS = @CPPFLAGS@
 
 ifdef PGXS
@@ -252,7 +252,7 @@
 ifdef PGXS
   LDFLAGS = -L$(libdir)
 else
-  LDFLAGS = -L$(top_builddir)/src/port -L$(top_builddir)/src/common
+  LDFLAGS = -L$(top_builddir)/src/port -L$(top_builddir)/src/common -L$(top_builddir)/src/interfaces/libpq -L$(top_builddir)/src/interfaces/ecpg/ecpglib -L$(top_builddir)/src/interfaces/ecpg/pgtypeslib -L$(top_builddir)/src/interfaces/ecpg/compatlib
 endif
 LDFLAGS += @LDFLAGS@
 
diff -Nurd postgresql-9.3.4/src/backend/utils/misc/postgresql.conf.sample postgresql-9.3.4-patched/src/backend/utils/misc/postgresql.conf.sample
--- postgresql-9.3.4/src/backend/utils/misc/postgresql.conf.sample	2014-03-17 15:35:47.000000000 -0400
+++ postgresql-9.3.4-patched/src/backend/utils/misc/postgresql.conf.sample	2014-04-17 10:13:22.000000000 -0400
@@ -78,7 +78,7 @@
 # - Security and Authentication -
 
 #authentication_timeout = 1min		# 1s-600s
-#ssl = off				# (change requires restart)
+ssl = off				# (change requires restart)
 #ssl_ciphers = 'DEFAULT:!LOW:!EXP:!MD5:@STRENGTH'	# allowed SSL ciphers
 					# (change requires restart)
 #ssl_renegotiation_limit = 512MB	# amount of data between renegotiations
diff -Nurd postgresql-9.3.4/src/bin/initdb/initdb.c postgresql-9.3.4-patched/src/bin/initdb/initdb.c
--- postgresql-9.3.4/src/bin/initdb/initdb.c	2014-03-17 15:35:47.000000000 -0400
+++ postgresql-9.3.4-patched/src/bin/initdb/initdb.c	2014-04-17 10:13:22.000000000 -0400
@@ -149,7 +149,7 @@
 
 /* defaults */
 static int	n_connections = 10;
-static int	n_buffers = 50;
+static int	n_buffers = 20;
 
 /*
  * Warning messages for authentication methods
diff -Nurd postgresql-9.3.4/src/interfaces/ecpg/compatlib/Makefile postgresql-9.3.4-patched/src/interfaces/ecpg/compatlib/Makefile
--- postgresql-9.3.4/src/interfaces/ecpg/compatlib/Makefile	2014-03-17 15:35:47.000000000 -0400
+++ postgresql-9.3.4-patched/src/interfaces/ecpg/compatlib/Makefile	2014-04-17 10:13:22.000000000 -0400
@@ -21,6 +21,7 @@
 	-I$(libpq_srcdir) -I$(top_srcdir)/src/include/utils $(CPPFLAGS)
 override CFLAGS += $(PTHREAD_CFLAGS)
 
+LDFLAGS := -L../ecpglib -L../pgtypeslib $(LDFLAGS)
 SHLIB_LINK = -L../ecpglib -lecpg -L../pgtypeslib -lpgtypes $(libpq) \
 	$(filter -lintl -lm, $(LIBS)) $(PTHREAD_LIBS)
 SHLIB_PREREQS = submake-ecpglib submake-pgtypeslib
diff -Nurd postgresql-9.3.4/src/interfaces/ecpg/ecpglib/Makefile postgresql-9.3.4-patched/src/interfaces/ecpg/ecpglib/Makefile
--- postgresql-9.3.4/src/interfaces/ecpg/ecpglib/Makefile	2014-03-17 15:35:47.000000000 -0400
+++ postgresql-9.3.4-patched/src/interfaces/ecpg/ecpglib/Makefile	2014-04-17 10:13:22.000000000 -0400
@@ -33,6 +33,7 @@
 OBJS += thread.o
 endif
 
+LDFLAGS := -L../pgtypeslib $(LDFLAGS)
 SHLIB_LINK = -L../pgtypeslib -lpgtypes $(libpq) $(filter -lintl -lm, $(LIBS)) $(PTHREAD_LIBS)
 SHLIB_PREREQS = submake-libpq submake-pgtypeslib
 
diff -Nurd postgresql-9.3.4/src/makefiles/Makefile.darwin postgresql-9.3.4-patched/src/makefiles/Makefile.darwin
--- postgresql-9.3.4/src/makefiles/Makefile.darwin	2014-03-17 15:35:47.000000000 -0400
+++ postgresql-9.3.4-patched/src/makefiles/Makefile.darwin	2014-04-17 10:13:22.000000000 -0400
@@ -10,4 +10,4 @@
 
 # Rule for building a shared library from a single .o file
 %.so: %.o
-	$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SL) -bundle $(BE_DLLLIBS) -o $@ $<
+	$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SL) -bundle $(BE_DLLLIBS) -undefined dynamic_lookup -o $@ $<
