Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 3, 2009, 09:37 AM   #1
duggram
macrumors 6502
 
Join Date: Apr 2008
Setting shmmax in /etc/rc to install Postgres

How do I set shmmax in /etc/rc? Literally what would the entry look like and where do I put it in the file?

I'm revisiting a problem I've had for a while now. I can't run Postres on my MBP, OS X 10.5.7, 4GB RAM, because I can't set shmmax.

Here are the sys requirements from the postgres readme:
Code:
On a MacBook Pro with 2GB of RAM, the author's sysctl.conf contains:

kern.sysv.shmmax=1610612736
kern.sysv.shmall=393216
kern.sysv.shmmin=1
kern.sysv.shmmni=32
kern.sysv.shmseg=8
kern.maxprocperuid=512
kern.maxproc=2048
My current sysctl.conf file but the shmmax is never set:
Code:
kern.sysv.shmmax=4292870144
kern.sysv.shmall=393216
kern.sysv.shmmin=1
kern.sysv.shmmni=32
kern.sysv.shmseg=8
kern.maxprocperuid=512
kern.maxproc=2048
Results from doing a sysctl -a show that I only have a fraction of the shmmax memory required by Postgres to run. In fact when I try to start Postgres it throws up an error message and quits.
Code:
kern.sysv.shmall: 393216
kern.sysv.shmseg: 8
kern.sysv.shmmni: 32
kern.sysv.shmmin: 1
kern.sysv.shmmax: 4194304
kern.sysv.semume: 10
kern.sysv.semmsl: 87381
kern.sysv.semmnu: 87381
kern.sysv.semmns: 87381
kern.sysv.semmni: 87381

There is this post from another thread:
Quote:
Originally Posted by lee1210 View Post
http://joseph.randomnetworks.com/arc...sysctl-values/

That post has a discussion about this. The sysctl command will change things for the current session, but you'll need to change the value in /etc/rc or all shmem values in sysctl.conf for this to survive a reboot. ...
-Lee
Here is my current rc.common file:
Code:
##
# Common setup for startup scripts.
##
# Copyright 1998-2002 Apple Computer, Inc.
##

#######################
# Configure the shell #
#######################

##
# Be strict
##
#set -e
set -u

##
# Set command search path
##
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/System/Library/CoreServices; export PATH

##
# Set the terminal mode
##
#if [ -x /usr/bin/tset ] && [ -f /usr/share/misc/termcap ]; then
#    TERM=$(tset - -Q); export TERM
#fi

####################
# Useful functions #
####################

##
# Determine if the network is up by looking for any non-loopback
# internet network interfaces.
##
CheckForNetwork()
{
    local test

    if [ -z "${NETWORKUP:=}" ]; then
	test=$(ifconfig -a inet 2>/dev/null | sed -n -e '/127.0.0.1/d' -e '/0.0.0.0/d' -e '/inet/p' | wc -l)
	if [ "${test}" -gt 0 ]; then
	    NETWORKUP="-YES-"
	else
	    NETWORKUP="-NO-"
	fi
    fi
}

alias ConsoleMessage=echo

##
# Process management
##
GetPID ()
{
    local program="$1"
    local pidfile="${PIDFILE:=/var/run/${program}.pid}"
    local     pid=""

    if [ -f "${pidfile}" ]; then
	pid=$(head -1 "${pidfile}")
	if ! kill -0 "${pid}" 2> /dev/null; then
	    echo "Bad pid file $pidfile; deleting."
	    pid=""
	    rm -f "${pidfile}"
	fi
    fi

    if [ -n "${pid}" ]; then
	echo "${pid}"
	return 0
    else
	return 1
    fi
}

##
# Generic action handler
##
RunService ()
{
    case $1 in 
      start  ) StartService   ;;
      stop   ) StopService    ;;
      restart) RestartService ;;
      *      ) echo "$0: unknown argument: $1";;
    esac
}

##########################
# Get host configuration #
##########################
. /etc/hostconfig
Any suggestions would be greatly appreciated.

Thank you, Doug
duggram is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Exchange Gmail push preserved with IOS7 install, what about clean install? jqc iOS 7 20 Sep 18, 2013 01:33 PM
How to clean install Windows 7 with Boot Camp without an install disc DESTROYERWORLD3 Windows, Linux & Others on the Mac 3 Apr 18, 2013 01:44 PM
MacBook pro running 10.5.8 won't install Snow Leopard, reboots 25% through install akmusher907 MacBook Pro 0 Feb 18, 2013 12:41 AM
My Mac won't install anything else than Leopard after clean install nampramos MacBook Pro 3 Jul 29, 2012 10:22 AM
Install iLife on a clean install of Mountain Lion Dano500 Mac Applications and Mac App Store 1 Jul 26, 2012 01:48 PM

Forum Jump

All times are GMT -5. The time now is 04:47 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC