OpenACS on Mac OS X Quickstart


By MarkD on December 2, 2002, updated Februrary 6, 2003.

These directions are getting a bit out of date. If you're wanting to be on the leading edge and use aolserver 4, pg 73, and openacs 5 beta, then check out Svet Ivantchev's instructions or Vinod Kurup's instructions or Stan Kaufman's instructions. The Epimetrics Group has an install guide too.

One question that comes up occasionally on OpenACS.org is "I have this great new TiBook. What does it take to get openacs running on Mac OS X?" Here are some notes for getting things up and running. Note that these aren't performance tuned, and don't include full-text search, but they will get you up and running to play with OpenACS. One assumption is that it's you on your personal machine. I don't do any of the "create new users for the database and web server" steps, and I'm kinda sloppy with where stuff gets put. I assume that everything will be run with my usual userid (markd), and I assume that you'll be wanting to take down the database and the webserver when you're playing.

For a production system, you should instead do All The Right Things. For development or just playing with OpenACS, it's just hassle.

I've included some of the tarballs that I use here, in case you have trouble finding the particular versions mentioned here (like it took me for-ev-er to find the approproite libxml sources)

Some of the oddities in getting things to work on Mac OS X is the two-level namespace stuff (which standard unix doesn't know about), and some wonkiness between the primarily SysV Linux world and the BSD Mac world.

The Official install Instructions are at http://openacs.org/doc/openacs-4/. Use those once you have some working binaries if you want to deploy a production system.


Postgresql

OpenACS uses either Oracle or Postgresql. These directions talk about postgresql.

Postgresql 7.3 and later compile cleanly onMac OS X, so if you're using one of the latest OpenACSs (4.6.3 or later), you can just install 7.3 and ignore the source code hacking below.

  1. untar the archive
  2. cd to the postgresql-7.X directory
  3. % ./configure

  4. Fix some code:
    replace
    #include "port/darwin/sem.h"
    with
    #include <sys/sem.h>
    in
    src/backend/storage/ipc/ipc.c
    src/backend/storage/lmgr/proc.c
    and src/backend/storage/lmgr/spin.c

  5. Hack src/backend/port/darwin/Makefile:
    remove sem.o from the OBJS setting
    (thanks to richmit for these hacks)

  6. % make

  7. go get some dinner

  8. % sudo make install

    This should put stuff into /usr/local/pgsql. One control-C should be enough to signal it and make the backend shutdown cleanly.

  9. put /usr/local/pgsql/bin into your path

  10. % sudo chown -R markd /usr/local/pgsql

  11. % initdb -D /usr/local/pgsql/data

  12. start it

    % /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data

    I just stick it into another shell

  13. % createlang plpgsql template1

  14. % createdb openacs

  15. % createuser opeancs
    (choose y for the two prompts)

  16. you can psql openacs and poke around for fun.
    openacs=# select * from pg_language;
     lanname  | lanispl | lanpltrusted | lanplcallfoid | lancompiler 
    ----------+---------+--------------+---------------+-------------
     internal | f       | f            |             0 | n/a
     C        | f       | f            |             0 | /bin/cc
     sql      | f       | f            |             0 | postgres
     plpgsql  | t       | t            |         16556 | 
  17. you can take it down by interrupting the postmaster session in the terminal
You may want to increase the memory allocated to postgresql.
  1. Edit /usr/local/pgsql/data/postgresql.conf, look for shared_buffers and set it to a larger value (I use 16384)

  2. Edit /System/Library/StartupItems/SystemTuning/SystemTuning to increase your system's shared memory settings. Search for 'shmmax', and tweak values upwards. This is what I'm using:
        sysctl -w kern.sysv.shmmax=167772160 # bytes: 160 megs
        sysctl -w kern.sysv.shmmin=1
        sysctl -w kern.sysv.shmmni=32
        sysctl -w kern.sysv.shmseg=8
        sysctl -w kern.sysv.shmall=65536 # 4k pages: 256 megs
    
  3. restart your system

AOLserver

I'v been using the "ad-13" version of AOLserver, available from OpenACS.org and from here. AOLserver 3.5 is out, and supposedly works with OpenACS. It looks like it requires building Tcl yourself, and since I have gotten this to work, I'm not interested yet in figuring that out.
  1. untar the archive. My tarball will make and expand into a directory named root

  2. % cd root/aolserver/include

  3. edit the Makefile.global. Search for "Mac OS X". Find the LDSO line and add -flat_namespace to it. The resulting line should look like:
    LDSO=$(LD) -bundle -undefined suppress -flat_namespace

  4. % cd .. (into aolserver)

  5. % make

  6. go out for a snack

  7. % sudo make install
    this will put things into /usr/local/aolserver/

  8. % sudo chown -R markd /usr/local/aolserver
(note: if you're getting strange errors like "Warning: modload: failed to load '/usr/local/aolserver/bin/nssock': 'Unknown dyld error'" when running AOLserver about not being able to load nssock.so or other shared libraries, add the line
set ext .so
to your opeancs.tcl configuration file. Thanks to Gunnar Hellekson for this tidbit.)

libxml2

XML, future
Where it is used, I know not.
OpenACS

Finding the tarball
from the usual sources
no luck. use this one

(Steve Ivy found libxml binaries pckaged as OS X frameworks at http://www.zveno.com/open_source/libxml2xslt.html, if you want to use those instead of building it yourself. You'll need to tweak the CFLAGS in the nsxml building below)

  1. unpack tarball, cd into the resulting directory (libxml2-2.4.26.tar.gz for the above tarball)

  2. % ./configure

  3. take out the python stuff from the top-level Makefile:

    replace the PYTHON line with
    PYTHON =

    replace the SUBDIRS and DIST_SUBDIRS lines with SUBDIRS = include . doc example
    DIST_SUBDIRS = include . doc example
    (you'll be taking off the python)

    in the EXTRA_DIST line, remove check-xml-test-suite.py and genUnicode.py

    add -flat_namespace to LDFLAGS:
    LDFLAGS = -flat_namespace

  4. edit libtool:

    archive_cmds, line 184, stick in -flat_namespace after -dynamiclib), so it looks like this:

    archive_cmds="\$CC \$(test .\$module = .yes && echo -bundle || echo -dynamiclib) -flat_namespace \$allow_undefined_flag -o \$lib \$libobjs \$deplibs\$linkopts -install_name \$rpath/\$soname \$(test -n \\\"\$verstring\\\" -a x\$verstring != x0.0 && echo \$verstring)"

  5. % make (go out to dinner)

  6. % sudo make install

    (this scatter sstuff into /usr/local/bin, lib, and include)
    you can make uninstall to get rid of things


libxslt

Here is my local copy of libxslt-1.0.22.tar.gz.
  1. untar the tarball and cd into the resulting directory

  2. % ./configure

  3. edit the Makefile add -flat_namespace to LDFLAGS

    change the PYTHON setting to say
    PYTHON = in the SUBDIRS section, remove the python \ line

    in DIST_SUBDIRS, remove python

    Apply same fix to libtool as above

  4. % make

  5. % sudo make install

Make AOLserver Modules

  1. cd to your aolserver 'root' directory (the top directory of the aolserver source tree)

nsxml

  1. unpack the nsxml.tgz package and cd into the resulting directory

  2. edit Makefile and add a CFLAGS before the include statement:
    CFLAGS += -I/usr/local/include/libxml2 -I/usr/local/include/libxslt -I/usr/local/libxslt

  3. % make

  4. % cp nsxml.so /usr/local/aolserver/bin

postgresql-driver

  1. unpack postgresql-driver.tgz and cd to the resulting directory

  2. % sudo ranlib /usr/local/pgsql/lib/libpq.a

  3. edit Makefile. Before the MOD = postgres.so line add
    PGINC = /usr/local/pgsql/include
    PGLIB = /usr/local/pgsql/lib

    change the OBJS line to this: OBJS = postgres.o -L$(PGLIB)

    There's something odd about the bit of shell script in this makefile. Rather than take the time to figure it out, I just hard code the paths.

  4. % make

  5. % cp postgres.so /usr/local/aolserver/bin
(If you get a weird error when you start AOLserver, like "Fatal: modload: no such symbol '_BIO_free'", try adding -lcrypto and -lssl to your PGLIB line in the makefile.

The rest

(if you didn't download the aolserver tarball above, you can get these other modules right here (18K))

  1. go into nscache
  2. % make
  3. % cp nscache.so /usr/local/aolserver/bin

  4. go into nsrewrite
  5. % make
  6. % cp nsrewrite.so /usr/local/aolserver/bin

  7. go into nssha1
  8. % make
  9. % cp nssha1.so /usr/local/aolserver/bin


Get OpenACS

The full poop on checkout instructions is at http://openacs.org/4/checkout. This is for the verson 4.6 branch from CVS.
  1. % sudo mkdir /web

  2. % sudo chown markd /web

  3. % cd /web

  4. % cvs -z3 -d :pserver:anonymous@openacs.org:/cvsroot login
    (password is just 'return')

  5. % cvs -z3 -d :pserver:anonymous@openacs.org:/cvsroot checkout -r oacs-4-6 openacs-4
    (downloads everything. This will take a while if you're on a really lousy net connection like what I have at home)

  6. % mv oacs-4-6 openacs

Get an AOLserver startup file

There's a canonical version of an AOLserver / OpenACS startup file at OpenACS.org. I put mine into /usr/local/aolserver, a bad habit from my arsDigita days. There's a couple of tweaks you may need to make:
  1. look for the set server line. change "birdnotes" to "openacs". Change "set servername" to "OpenACS Playground"
  2. if you get a pthread_stacksize error on launch, change the stack size to a value that's an even multiple of 4096, like 249856.
  3. set the address to be 127.0.0.1. Mac OS X has a nasty habit of dropping the ethernet device when there's no phyiscal cable hooked up to the machine and the airport can't find the network. The loopback address will always work.
  4. global search and replace nsadmin with openacs

Here is the version I'm using.

Launch

  1. fire up AOLserver:
    % cd /usr/local/aolserver
    % bin/nsd -fkt ./openacs.tcl

  2. Wait a bit and watch it load stuff. When you see "nssock: accepting connections", point your web browser to http://127.0.0.1:8000

    You should see a welcome page.

  3. click the Next button.
  4. go get a snack while it loads some data model stuff

  5. click the Next button again
  6. go get another snack while it loads more stuff

  7. click Next again and fill out admin stuff
  8. the web server will exit. re-run it and reload your browsre

  9. Have fun! you should now have a functional OpenACS install


borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com