Skip to content

Installing kdb+

You can run kdb+ on Linux, macOS, or Windows

kdb+ Personal Edition

If you have downloaded the kdb+ Personal Edition simply follow the installation instructions that came with it.

Installation instructions on this page are for reference and cover a variety of use cases.

You have the 64-bit kdb+ Personal Edition interpreter, licensed for non-commercial use. (32-bit interpreters are licensed only for commercial use.)

The interpreter is enabled by a kc.lic license-key file and requires an always-on Internet connection.

This version of kdb+ is not licensed for use on cloud servers.

You have the 64-bit interpreter and a k4.lic or kc.lic license-key file

OR

You have a 32-bit interpreter.

32-bit applications will not run in macOS 10.15+ (Catalina and later)

More about licensing

Step 1: Download

Commercial versions of kdb+ are available to customers from downloads.kx.com. (Credentials are available from customers’ Designated Contacts).

Internal distribution at customer sites

Most customers download the latest release of kdb+ (along with the accompanying README.txt, the detailed change list) and make a limited number of approved kdb+ versions available from a central file server.

Designated Contacts should encourage developers to keep production systems up to date with these versions of kdb+. This can greatly simplify development, deployment and debugging.

Platforms and versions

The names of the ZIPs denote the platform: l64.zip – 64-bit Linux; w32.zip – 32-bit Windows, etc. m64 contains a universal binary suitable for both Intel and Apple Silicon Macs. l64 contains the Linux x86 build, with l64arm containing the Linux build suitable for ARM processors.

Numerical release versions of the form 3.5, or 4.0 are production code. Versions of kdb+ with a trailing t in the name such as 3.7t are test versions and are neither intended nor supported for production use.

Step 2: Unzip your download

Here we assume you install kdb+ in your HOME directory on Linux or macOS; or in C:\ on Windows, and set the environment variable QHOME accordingly.

os        QHOME
---------------
Linux     ~/q
macOS     ~/q
Windows   c:\q

You can install kdb+ anywhere as long as you set the path in QHOME.

Open a command shell and cd to your downloads directory.

Unzip the downloaded ZIP to produce a folder q in your install location.

unzip l64.zip -d $HOME/q
unzip m64.zip -d $HOME/q
Expand-Archive w64.zip -DestinationPath C:\q
Recommended: rlwrap for Linux and macOS

On Linux and macOS the rlwrap command allows the Up arrow to retrieve earlier expressions in the q session. It is very useful and we recommend installing it.

Unwrapping rlwrap

Ask for its version number: rlwrap -v. If you see one, rlwrap is already installed. Otherwise, you will see rlwrap: command not found.

Install rlwrap using your package manager. (Common package managers: apt, dnf and yum for Linux; Homebrew and MacPorts for macOS.)

How to run 32-bit kdb+ on 64-bit Linux

Use the uname -m command to determine whether your machine is using the 32-bit or 64-bit Linux distribution.

If the result is

  • i686 or i386 or similar, you are running a 32-bit Linux distribution
  • x86_64, you are running a 64-bit Linux distribution

To install 32-bit kdb+ on a 64-bit Linux distribution, you need a 32-bit library. Use your usual package manager to install i686 or i386: for example, sudo apt-get install libc6-i386.

How to run 32-bit app in Ubuntu 64-bit?

Step 3: Install the license file

If you have a license file, k4.lic or kc.lic, put it in the QHOME directory.

Your QHOME directory will then contain:

├── kc.lic
├── l64/
│   └── q
└── q.k
├── kc.lic
├── m64/
│   └── q
└── q.k
├── kc.lic
├── w64/
│   └── q
└── q.k

(32-bit versions have 32 in the folder name instead of 64.)

Kdb+ looks for a license file in QHOME. To keep your license file elsewhere, set its path in environment variable QLIC.

Working with multiple versions of kdb+

Step 4: Confirm success

Confirm kdb+ is working: launch your first q session.

cd
q/l64/q
cd
spctl --add q/m64/q
xattr -d com.apple.quarantine q/m64/q
q/m64/q
c:\q\w64\q
Authorizing macOS to run kdb+

MacOS Catalina (10.15) introduced tighter security. It may display a warning that it does not recognize the software.

Catalina warning

If the spctl and xattr commands above have not authorized the OS to run q, open System Preferences > Security & Privacy.

You should see a notification that q has been blocked – and a button to override the block.

Safely open apps on your Mac

The q session opens with a banner like this.

KDB+ 4.0 2020.06.01 Copyright (C) 1993-2020 Kx Systems
m64/ 12()core 65536MB sjt mackenzie.local 127.0.0.1 EXPIRE…

q)

License errors, Licensing

License files and 32-bit kdb+

32-bit kdb+ does not require a license file to run, but if it finds one at launch it will signal a license error if the license is not valid.

Try your first expression.

q)til 6
0 1 2 3 4 5

End the q session and return to the command shell.

q)\\
$

Step 5: Edit your profile

Defining q as a command allows you to invoke kdb+ without specifying the path to it.

The q interpreter refers to environment variable QHOME for the location of certain files. Without this variable, it will guess based on the path to the interpreter. Better to set the variable explicitly.

The QLIC environment variable tells kdb+ where to find a license key file. Absent the variable, QHOME is used.

  1. Open ~/.bash_profile in a text editor, append the following line, and save the file. (Edit ~/.bashrc to define a q command for non-console processes.)
  2. alias q='QHOME=~/q rlwrap -r ~/q/l64/q'
  3. In the command shell, use the revised profile: source .bash_profile
  1. Open ~/.zshrc in a text editor, append the following lines, and save the file.
  2. alias q='QHOME=~/q rlwrap -r ~/q/m64/q'
  3. In the command shell, use the revised profile: source ~/.zshrc

In the command shell issue the following commands:

  1. setx QHOME "C:\q"
  2. setx PATH "%PATH%;C:\q\w64"

(In the above, substitute 32 for 64 if you are installing 32-bit kdb+.)

Test the new command. Open a new command shell and type q.

Last login: Sat Jun 20 12:42:49 on ttys004
❯ q
KDB+ 4.0 2020.06.01 Copyright (C) 1993-2020 Kx Systems
m64/ 12()core 65536MB sjt mackenzie.local 127.0.0.1 EXPIRE…

q)

Installing multiple versions of kdb+

Interactive development environments

If you are a solo student, we recommend learning q by running it from a command shell, as a REPL, writing scripts in a text editor. The examples on this site are produced that way; visual fidelity should help you as you learn.

Jupyter notebooks are an interactive publishing format. We are producing lessons in this form and the library is growing. The JupyterQ interface lets you run q code in notebooks.

Notebooks are not, however, an IDE, and are unsuitable for studying features such as event handlers.

For more advanced study, use either the bare q REPL, or download and install our interactive development environment, KX Developer.

What’s next?

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