Installing DB2 on Mac OS X

It’s useful to have a local installation of the DB2 on Mac for development and test purposes. I have a local installation on my Macbook to develop DB2-backed Ruby on Rails applications.

IBM DB2 is a mature relational database server. It supports lots of neat things like SQL, XQuery for XML, SPARQL for RDF, full text search, and so on.

DB2 on Mac using DockerDB2 on Mac logo

A quicker option for getting running with DB2 on Mac is to use the DB2 docker image. It should get you started quickly with DB2 by running it in a virtualized Linux environment on your Mac.

DB2 on Mac natively

Here are the current instructions for installing DB2 10.1 on Mac OS X, courtesy of my colleague Kevin Rose:

Instructions to install DB2 v10.1 on Mac OS X Yosemite:

Prerequisite: XCode developer tools must be installed. These can be installed from the Mac App Store.

1. Ensure the following entries are in the /etc/sysctl.conf. Create the file /etc/sysctl.conf if it does not exist.

Restart your Mac after creating the file to make the values take effect.

2. Open a terminal with a shell for the the user that will become instance owner.

3. Ensure that otool is in the path. Execute otool:

If the error is “command not found” then run the following

4. Extract the DB2 install image from the tar archive:

The image will be extracted into an expc directory.

5. Enter the expc directory and run the installer and perform a non-root install:

This will install DB2 to the following default location: /Users/$(whoami)/sqllib

Execute step 6 if you need to enable connections for a userid other than the instance owner:

6. Enable OS authentication. (You need to be an Admin user to run these commands):

The instructions for starting DB2 and configuring remote access are the same as before.

Published by

Leons Petrazickis

I'm a full-stack developer at IBM Analytics Emerging Technologies. I do Ruby, JS, Python, Hadoop, Spark, as well as web scale devops with Chef and Docker. My opinions are my own.