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 Docker
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.
kern.sysv.shmmax=1073741824 kern.sysv.shmmin=1 kern.sysv.shmmni=4096 kern.sysv.shmseg=32 kern.sysv.shmall=1179648 kern.maxfilesperproc=65536 kern.maxfiles=65536
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:
tar -xzvf db2_v101_macos_expc.tar.gz
The image will be extracted into an expc directory.
5. Enter the expc directory and run the installer and perform a non-root install:
cd expc db2_install # *** DO NOT RUN db2_install AS ROOT ***
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):
cd /Users/$(whoami)/sqllib/security sudo chown root /Users/$(whoami)/sqllib/security/db2ckpw sudo chmod u+rxs /Users/$(whoami)/sqllib/security/db2ckpw sudo chmod o+rx /Users/$(whoami)/sqllib/security/db2ckpw
The instructions for starting DB2 and configuring remote access are the same as before.