You will have to install an optimized and a debug version for every library.

Disclaimer : These are instructions that worked for me, for my architecture, my computer etc. I do not guarantee and won't even suggest they should work for you.

I run a Mac OS X 10.6.8 Snow Leopard.

First, PETSC :

Optimized :

./config/configure.py --with-fortran=0 --with-clanguage=C++ --with-clanguage=C --CFLAGS=-O3 --FFLAGS=-O3 --with-debugging=no --with-shared=1 --with-dynamic=1 --download-openmpi=1

export PETSC_DIR=/Where/is/petsc/petsc-3.1-p8 PETSC_ARCH=darwin10.8.0-c-opt
make all
make test

Debug :

./config/configure.py --with-fortran=0 --with-clanguage=C++ --with-clanguage=C --with-debugging=yes --with-shared=1 --with-dynamic=1 --download-openmpi=1

export PETSC_DIR=/Where/is/petsc/petsc-3.1-p8 PETSC_ARCH=darwin10.8.0-c-debug
make all
make test

Second, SLEPC :

Optimized :

export PETSC_DIR=/Where/is/petsc/petsc-3.1-p8 PETSC_ARCH=darwin10.8.0-c-opt SLEPC_DIR=/Where/is/slepc/slepc-3.1-p6
./configure
make
make test

Debug :

export PETSC_DIR=/Where/is/petsc/petsc-3.1-p8 PETSC_ARCH=darwin10.8.0-c-debug SLEPC_DIR=/Where/is/slepc/slepc-3.1-p6
./configure
make
make test

Third, LIBMESH :

Optimized :

export PETSC_DIR=/Where/is/petsc/petsc-3.1-p8 PETSC_ARCH=darwin10.8.0-c-opt SLEPC_DIR=/Where/is/slepc/slepc-3.1-p6

make
make run_examples

Debug :

export PETSC_DIR=/Where/is/petsc/petsc-3.1-p8 PETSC_ARCH=darwin10.8.0-c-debug SLEPC_DIR=/Where/is/slepc/slepc-3.1-p6 METHOD=dbg`

make
make run_examples