Skip to content

Installing under macOS

After downloading, if necessary, unzip the archive. A new folder q will appear in your Downloads folder.

Next perform the Minimum install and launch. We then strongly recommend continuing to Complete install and launch.

Minimum install and launch

Open the Terminal application and enter the following commands:

$ cd ~/Downloads
~/Downloads$ cp -r q ~/.
~/Downloads$ cd ~
$ q/m32/q
KDB+ 3.6 2018.07.30 Copyright (C) 1993-2018 Kx Systems
m32/ 2()core 4096MB sjt mark.local 192.168.0.17 NONEXPIRE

Welcome to kdb+ 32bit edition
For support please see http://groups.google.com/d/forum/personal-kdbplus
Tutorials can be found at http://code.kx.com/q/tutorials/install
To exit type \\
To remove this startup msg, edit q.q
q)til 6 / first 6 integers
0 1 2 3 4 5
q)\\
$

You have installed and launched kdb+.

To exit from kdb+, type \\

Complete install and launch

The minimum installation can be improved in two important ways. We strongly recommend them.

  • Call kdb+ within the rlwrap command, which will allow you to call back and edit previous lines
  • Define q as a command alias, allowing you to invoke kdb+ without specifying the path to it

Install Rlwrap

Exit kdb+ to return to the command prompt and your home folder. Ask for Rlwrap’s version number. If you see one, Rlwrap is already installed.

q)\\
$ rlwrap -v
rlwrap 0.42
$

If Rlwrap is already installed you can go on to the next step.

Otherwise, you will be told rlwrap: command not found. Install Rlwrap using your package manager. (Probably either MacPorts or Homebrew)

Edit your profile

In Terminal (Bash), open your profile ~/.bashrc with TextEdit (or your favourite text editor),

$ open -a "Sublime Text" .bashrc

append the following line

alias q='QHOME=~/q rlwrap -r ~/q/m32/q'

and save it. Start a new Terminal session, or tell Bash to use the revised profile:

$ source .bashrc

Installing elsewhere

You can install kdb+ where you please. The environment variables QHOME (specified above) and QLIC tell kdb+ where to find its files.

Confirm successful installation

From your home folder, launch kdb+, type an expression and recall it using the up-arrow key:

$ q
KDB+ 3.6 2018.07.30 Copyright (C) 1993-2018 Kx Systems
m32/ 2()core 4096MB sjt mark.local 192.168.0.17 NONEXPIRE

Welcome to kdb+ 32bit edition
For support please see http://groups.google.com/d/forum/personal-kdbplus
Tutorials can be found at http://code.kx.com/q/tutorials/install
To exit type \\
To remove this startup msg, edit q.q
q)til 6 / first 6 integers
0 1 2 3 4 5
q)til 6 / first 6 integers
0 1 2 3 4 5
q)\\
$

Install a license key file

64-bit kdb+ requires a license key file. Obtain and install one.

You’re done. You have completely installed kdb+.

What’s next?

Get started with the q programming language, look through the reference card, or see in the Cookbook what you can do with kdb+.