Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
22 replies Latest Post - ‏2015-05-20T18:38:44Z by prl99
LeoPetraz
LeoPetraz
228 Posts
ACCEPTED ANSWER

Pinned topic DB2 Express-C 10.1 for Mac OS X installation guide

‏2013-01-10T21:37:53Z |

DB2 Express-C installation guide for Mac OS X

Prerequisites

  • Mac OS X Mountain Lion or newer
  • XCode developer tools must be installed. These can be installed from the Mac App Store.


Configure Mac OS X and install DB2 (updated 2015-05-20)

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:

     otool

If the error is "command not found" then run the following

     export PATH=$PATH*:*/Applications/XCode.app/Contents/Developer/usr/bin

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

     tar -xvf 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)/security
         sudo chown root /Users/$(whoami)/sqllib/security/db2chkpw
         sudo chmod u+rxs o+rx  /Users/$(whoami)/sqllib/security/db2chkpw

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

In case you're reinstalling

7. Re-catalog your previous database. If you have a local database the following should do the work
    
        db2 catalog db <db_name>


Start DB2 Server

Open up the Terminal.

Become the DB2 instance owner user:

su - db2inst1 # assuming db2inst1 is your DB2 user

Initialize the environment for DB2:


cd $HOME/sqllib 
.   ./db2profile


Start DB2:


db2start

Network access

If you need to access this DB2 instance remotely, you should configure the service:

db2 update dbm cfg using svcename db2c_db2inst1 # assuming db2inst1 is your DB2 user

sudo su -

echo 'db2c_db2inst1 50000/tcp' >> /etc/services # assuming db2inst1 is your DB2 user

exit

db2set -all
db2set DB2COMM=TCPIP
db2stop force
db2start

DB2 tips

Create a database:

db2 create database yfs on /Users/db2inst1/db2 # assuming db2inst1 is your DB2 user

Find your JDBC driver (db2jcc.jar):

cd /opt/IBM/db2/V10.1/java

open .

Updated on 2015-05-20T19:36:42Z at 2015-05-20T19:36:42Z by LeoPetraz
  • SystemAdmin
    SystemAdmin
    5837 Posts
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2013-01-13T11:18:32Z  in response to LeoPetraz
    There is a Typo!

    export PATH=$PATH_:_/Applications/XCode.app/Contents/Developer/usr/bin
  • SystemAdmin
    SystemAdmin
    5837 Posts
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2013-01-13T11:20:24Z  in response to LeoPetraz
    There is a Typo!

    export PATH=$PATH*:*/Applications/XCode.app/Contents/Developer/usr/bin
  • SystemAdmin
    SystemAdmin
    5837 Posts
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2013-01-13T20:03:39Z  in response to LeoPetraz
    I had to do two additional steps to get the database to communicate with my application. 1. Update the service name and then tell db2 to use TCPIP

    This might be because I created a seperate user account on my machine to run db2. (db2inst1)

    Using db2inst1 user account I typed the following:

    db2 update dbm cfg using svcename db2c_db2inst1

    Then under my admin ID for my Mac I did:

    sudo vim /etc/services
    I then added the following to the bottom of the file and saved it.
    db2c_db2inst1 50000/tcp
    Then under the db2inst1 account I typed:

    db2set DB2COMM=TCPIP

    Finally I did
    db2stop
    db2start
    I can not connect from my java application to db2
    • c.kuhroeber
      c.kuhroeber
      25 Posts
      ACCEPTED ANSWER

      Re: DB2 Express-C 10.1 for Mac OS X installation guide

      ‏2014-01-07T10:12:12Z  in response to SystemAdmin

      Hi,

       

      well, you wrote, that you can't connect do DB2 with your Java application ... Same for me here, too.

      Did you already find a solution for that (I know, that this thread is already a couple of months old, but I just came to get my MacBook and I'm doing my first steps).

      I can connect to my DB2 10.1 with db2 command line tool but I can't use for instance the Database Explorer that is shipped with (My)Eclipse - which a Java application. Also - after setting the Oracle Compatibility - I cannot connect with clpplus (which in turn uses Java as well).

       

      Best regards and thx in advance ;-)

      Christian

  • SystemAdmin
    SystemAdmin
    5837 Posts
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2013-01-25T04:29:42Z  in response to LeoPetraz
    saya sudah mengikuti nya semua langkah tetapi masih belum bisa ya? ketika saya masuk untuk perintah ./db2setup nya terima kasih
    • LeoPetraz
      LeoPetraz
      228 Posts
      ACCEPTED ANSWER

      Re: DB2 Express-C 10.1 for Mac OS X installation guide

      ‏2013-01-25T19:44:25Z  in response to SystemAdmin
      Sila hantar sebarang mesej ralat yang anda lihat. Adalah sukar untuk membantu tanpa mengetahui butiran lanjut.

      Regards,

      Leons
      • SystemAdmin
        SystemAdmin
        5837 Posts
        ACCEPTED ANSWER

        Re: DB2 Express-C 10.1 for Mac OS X installation guide

        ‏2013-02-21T11:08:54Z  in response to LeoPetraz
        Laputik sara kruf? Evehreey?
  • XV5J_santosh_Rao
    XV5J_santosh_Rao
    2 Posts
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2013-12-01T19:16:00Z  in response to LeoPetraz

    Hello,

    I successfully installed DB2 10.1 on my mountain lion macbook pro and created the instance following the steps you provided.

    But when I run $HOME/sqllib  ./db2profile I am getting error message 

    "./db2profile: line 177: ulimit: open files: cannot modify limit: Invalid argument"

    When i run db2start i get the following error message

    "SQL1220N  The database manager failed to allocate shared memory."

    I couldn't find any solution anywhere. Please help.

    I even tried running sqllib/bin/db2ftok but it does not create .ftok file.

    regards

    Santosh

    • XV5J_santosh_Rao
      XV5J_santosh_Rao
      2 Posts
      ACCEPTED ANSWER

      Re: DB2 Express-C 10.1 for Mac OS X installation guide

      ‏2013-12-03T18:17:42Z  in response to XV5J_santosh_Rao

      Hello

       

      My issue resolved.  db2start is working now. I am not sure what was the issue but i removed :install db2" from the /etc/sysctl.conf file

      i copied the below content from here

      "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 Install DB2"

      which has "Install DB2 " . I removed it and rebooted the mac and db2start worked.

      Thanks

      Santosh

       

  • MajaDjordjevic
    MajaDjordjevic
    1 Post
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2013-12-23T14:13:20Z  in response to LeoPetraz

    It seems that my username gets obfuscated when I try and create my instance

    This is the command I'm running:

    ./db2icrt -u 'mdjordjevic' 'mdjordjevic'
    

    and I get this error message:

    DBI1131E  The user ID mdjordje is invalid.
    

     

  • janetrm
    janetrm
    5 Posts
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2013-12-31T20:23:28Z  in response to LeoPetraz

    Hi

    I already installed db2

    dc60client:~ root# db2ls

    Install Path                       Level   Fix Pack   Special Install Number   Install Date                  Installer UID 

    ---------------------------------------------------------------------------------------------------------------------

    /opt/IBM/db2/V10.1               10.1.0.0        0                            Thu Dec 26 00:25:44 2013 CST             0 

     

    But When I tried to create an instance of DB2 I had an error related to Hostname

    dc60client:instance root# ./db2icrt -a server -u db2fenc1 db2inst1

    DBI1446I  The db2icrt command is running, please wait.

    DB2 installation is being initialized.

     The host name "dc60client.spss.com" is invalid. Specify a valid host name.

    A major error occurred during the execution that caused this program to 

    terminate prematurely. If the problem persists, contact your technical service 

    representative.

    For more information see the DB2 installation log at 

    "/tmp/db2icrt.log.11022".

    DBI1264E  Errors were encountered in running db2icrt. Please

          refer to the installation log file /tmp/db2icrt.log.11022 for more

          information.

    I change the Hostname but I got the  same  error

    macbookpro:instance root# ./db2icrt -a server -u db2fenc1 db2inst1

    DBI1446I  The db2icrt command is running, please wait.

    DB2 installation is being initialized.

     The host name "macbookpro" is invalid. Specify a valid host name.

    A major error occurred during the execution that caused this program to 

    terminate prematurely. If the problem persists, contact your technical service 

    representative.

    For more information see the DB2 installation log at 

    "/tmp/db2icrt.log.16620".

    DBI1264E  Errors were encountered in running db2icrt. Please

          refer to the installation log file /tmp/db2icrt.log.16620 for more

          information.

    Do you have any idea what is causing this error?

  • LeoPetraz
    LeoPetraz
    228 Posts
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2014-01-15T18:51:52Z  in response to LeoPetraz

    I've made some small updates to the guide to fix typos and provide additional guidance.

    It's better to use a dedicated user like db2inst1 for the DB2 instance. This avoids permissions and username length issues.

    - Leons

  • oliverqg
    oliverqg
    1 Post
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2014-03-13T14:18:23Z  in response to LeoPetraz

    This guide worked for me perfectly.  Thanks.

  • teetom
    teetom
    1 Post
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2014-03-18T13:28:05Z  in response to LeoPetraz

    Can someone tell me how to uninstall DB2 on Mac, I am not familiar with Mac?

    I accidentally ran the db2setup file without configuration listed in this topic. The installation ended in some error. 

    • LeoPetraz
      LeoPetraz
      228 Posts
      ACCEPTED ANSWER

      Re: DB2 Express-C 10.1 for Mac OS X installation guide

      ‏2014-03-21T19:36:45Z  in response to teetom

      Hi teetom

      Here's the information I have on uninstalling DB2 Express-C on Mac. It assumes a slightly older version, but the steps should still be the same:

      The db2_deinstall script is usually the recommended method for uninstalling DB2, however there are some outstanding issues with the db2_deinstall script on Mac OS X. Until these issues are fixed, you can uninstall DB2 manually by deleting the directories where DB2 is installed. If you performed an Admin user install, you need to remove the DB2 install dir as an Admin user by running sudo rm -rf <DB2 installdir> from the Terminal command line.

      Delete the following directories.
      DB2 install dir (eg /opt/ibm/db2/V10.1 for Admin user installs, ~/sqllib for Standard User installs)

      DB2 instance dir (for Admin installs only, eg ~<instance owning user>/sqllib
      DB2 database directory (~<instance owning user>/<instance owning user>, eg ~rchase/rchase)

       

  • Mark McConnell
    Mark McConnell
    1 Post
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2014-04-15T19:01:31Z  in response to LeoPetraz

    The guide worked well for me. No Problems at all.

    One thing that may help - you don't need to install the full Xcode setup. You just need the command line tools, which is a much smaller package.

    I installed them a while back, from memory just see if gcc is installed if it is you have the tools if not the system will prompt you.

    Select install NOT Get Xcode.

  • Innsbruck
    Innsbruck
    1 Post
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2014-08-05T20:29:41Z  in response to LeoPetraz

    Xcode 5.1.1  - no file otool found

    On my Mountailn Lion Mac Book - I installed for the first time Xcode - in Version 5.1.1. there is no file otool in the directory

    
    /Applications/XCode.app/Contents/Developer/usr/bin.
    

    on my mac mini with Lion / XCode 4.2.  the file is in  /usr/bin/otool

     

  • prl99
    prl99
    2 Posts
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2015-03-21T21:23:04Z  in response to LeoPetraz

    Now that Apple and IBM have declared themselves partners, when will an official DB2 Express-C installation package be made available for OS X 10.10.x? It only makes senses for IBM to officially support it so Mac users can develop databases off-line that run natively on Apple hardware. Oracle gave up on Macs years ago but it looks like there might be a future for IBM databases running on Macs without virtualization or from the cloud.

    • krrose
      krrose
      1 Post
      ACCEPTED ANSWER

      Re: DB2 Express-C 10.1 for Mac OS X installation guide

      ‏2015-05-19T19:04:07Z  in response to prl99

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

      Prereq: 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:
          otool

      If the error is "command not found" then run the following
          export PATH=$PATH*:*/Applications/XCode.app/Contents/Developer/usr/bin

      4. Extract the DB2 install image from the tar archive:
          tar -xvf <imagename>

      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/<userid>/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/<userid>/security
              sudo chown root /Users/<userid>/sqllib/security/db2chkpw
              sudo chmod u+rxs o+rx  /Users/<userid>/sqllib/security/db2chkpw
          

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

  • prl99
    prl99
    2 Posts
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2015-05-20T18:38:44Z  in response to LeoPetraz

    Thank you for providing these instructions but my original request had more to do with the lack of a typical OSX installer than how to actually install this software. If Apple and IBM are going to work together, IBM needs to realize there's a much easier way for Mac users to install software than using the terminal to enter a consistent set of commands. This is what an installer is for and depending on how many things change in the installation due to hardware and software, a set of binaries could probably be provided with a proper installation app that adds the sysctl.conf file as well as asking which userID to run the server application under. I know most of you on this forum only use the terminal but this database software is not for the typical large system installation so you'll have more small system installations looking to make use of the applications Apple and IBM are currently releasing. 

     

    Thanks for the instructions. I will give it shot.