dboettger's Blog

Posts Tagged ‘MacOSX

Last year on the PHP Conference in Mainz it was the first time i heard about couchdb. I was quite impressed, but had no use case for this database. In the near future i will need to improve our document handling in the applications. So i want to work with couchdb to improve versioning and searching.

You can find more information about couchdb on http://couchdb.apache.org.

As anybody know, the first step is to install the couchdb on the local system. As i am a apple follower ;-). I looked for a guide to install it on snow leopard.

Original information from http://blog.deadinkvinyl.com/2008/07/12/couchdb-on-macosx-leopard/

I did some corrections for the copy and paste guys like me ;-). But the original post has much more information about the single steps.

# Install needed packages via macports
sudo port install icu erlang spidermonkey

# Download the latest couchdb file
tar xvzf apache-couchdb-0.10.0.tar.gz

sudo make install

# Show all used userId’s
dscl . -list /Users UniqueID | awk ‘{print $2}’ | sort -n

# Show all used groupId’s
dscl . -list /Groups PrimaryGroupID | awk ‘{print $2}’ | sort -n

# We use groupid and userid 103 for the couchdbuser
sudo dseditgroup -o create -i 103 -r “CouchDB Users” couchdb
sudo dscl . -create /Users/couchdb
sudo dscl . -create /Users/couchdb UniqueID 103
sudo dscl . -create /Users/couchdb UserShell /bin/bash
sudo dscl . -create /Users/couchdb RealName “CouchDB Administrator”
sudo dscl . -create /Users/couchdb NFSHomeDirectory \
sudo dscl . -create /Users/couchdb PrimaryGroupID 103
sudo dscl . -create /Users/couchdb Password *

sudo chown -R couchdb:couchdb /usr/local/var/lib/couchdb
sudo chown -R couchdb:couchdb /usr/local/var/log/couchdb

# Startup couchdb

sudo -u couchdb couchdb

Create a copy of the plist file and edit it.

cp /usr/local/Library/LaunchDaemons/org.apache.couchdb.plist \
open /var/tmp/org.apache.couchdb.plist

1. Open Root → EnvironmentVariables
2. Click on Add Child
3. Name: PATH
4. Value: /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin
5. File → Save
6. Quit Property List Editor

sudo cp /var/tmp/org.apache.couchdb.plist \

# To control the database, simply execute
sudo launchctl load \
# to start
# or
sudo launchctl unload \
# to stop the database

# Automatically launch
sudo ln -s /usr/local/Library/LaunchDaemons/org.apache.couchdb.plist \



Just install the package from mysql.com.


First install the Macport from macports.org. You also need the Apple developer tools to compile software. The developmentkit from apple ships with the wonderful gcc compiler ;-).

After you install macports ( a package management for MacOSX) you are able to install the needed libraries. Just execute the following commands:

sudo port install jpeg
sudo port install libpng
sudo port install freetype
sudo port install mcrypt
sudo port install libiconv
sudo port install cclient

Oracle Installation (Instantclient only):

Download the oracle client basic Version 10.2 and SDK 10.2 from the Oracle download page.
Move the extracted files to /opt/instantclient_10_2.

export LD_LIBRARY_PATH=/opt/oracle/instantclient_10_2/sdk/include/:/opt/oracle/instantclient_10_2:.

cd /opt/instantclient_10_2
ln -s libclntsh.dylib.10.1 libclntsh.dylib
ln -s libclntsh.dylib libclntsh.so

export NLS_LANG=”American_America.UTF8″
export DYLD_LIBRARY_PATH=/opt/instantclient_10_2

Download php 5.2.11 from php.net.
Extract the php sourcefile into a diretory.

./configure –prefix=/usr –with-apxs2=/usr/sbin/apxs –with-ldap=/usr –with-kerberos=/usr –enable-cli –with-zlib-dir=/usr –enable-exif –enable-ftp –enable-mbstring –enable-mbregex –enable-sockets –with-iodbc=/usr –with-curl=/usr –with-config-file-path=/etc –sysconfdir=/private/etc –with-mysql-sock=/var/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config –with-mysql=/usr/local/mysql –with-openssl=shared,/opt/local –with-xmlrpc –with-xsl=/usr –with-pear –with-libxml-dir=/usr –with-iconv=shared,/opt/local –with-pdo-mysql=/usr/local/mysql/bin/mysql_config –with-gd –with-jpeg-dir=/opt/local –with-png-dir=/opt/local –with-freetype-dir=/opt/local –with-mcrypt=/opt/local –with-imap=/opt/local –with-imap-ssl –enable-soap –with-oci8=instantclient,/opt/instantclient_10_2 –with-pdo-oci=instantclient,/opt/instantclient_10_2,

We have to edit the Makefile to run a successful compile.

nano Makefile
Edit the line with the EXTRA_LIBS = ….. stuff.
Add -lresolv to the line, save and exit the file.

After editing the Makefile we are able to compile the binaries. Just enter make to execute the compilation.

If make was successful we have to execute make install as superuser. The command sudo make install is our friend ;-).

We have to create the following directory and link the library to it. Don’t ask just the strange oraclestuff.
mkdir -p /b/32_216/rdbms/lib
ln -s /opt/instantclient_10_2/libclntsh.dylib.10.1 /b/32_216/rdbms/lib/

Apache configuration

The last modification we have to add is the initconfiguration of the apacheservice. We need some variables set in the runtime environment.

We will edit the /System/Library/LaunchDaemons/org.apache.httpd.plist file like that or something similar for you locales.

nano /System/Library/LaunchDaemons/org.apache.httpd.plist


<!DOCTYPE plist PUBLIC “-//Apple Computer//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”&gt;
<plist version=”1.0″>


I hope i was able to help you guys. If you have any question, don’t hesitate to contact me or post some comments.

A few days ago i had some trouble with my Address Book. The firstname and the lastname of any persons were inverted. The problem began with a sync of a Sony Ericsson K610i. After this sync the firstname of a person has been written in the column lastname and the lastname has been written in the column firstname.

After a few minutes looking for a solution included in the Address Book application i thought there was no option to invert the firstname and the lastname.

I wrote a small applescript and hope if somebody will have the same problem he will be able to use my script. In my case it worked like a charm.

tell application "Address Book"
repeat with this_person in every person
set first_name to first name of this_person as string
set last_name to last name of this_person as string
if not first_name = "missing value" then
set last name of this_person to first_name
delete last name of this_person
end if
if not last_name = "missing value" then
set first name of this_person to last_name
delete first name of this_person
end if
end repeat
end tell