Programming/Kdb/Installing kdb

From Thalesians Wiki
< Programming‎ | Kdb
Revision as of 17:06, 17 June 2021 by Admin (talk | contribs)



Kdb+/q can be downloaded from

In particular, there are two free versions of kdb+/q: the 32 Bit Personal Edition and the 64 Bit Personal Edition (On-Demand).

Both editions are licensed for personal use.

The 32 Bit Personal Edition:

  • is permitted to run on-premises;
  • is permitted to run on cloud;
  • provides access to KX Fusion interfaces and integrations;
  • provides access to community support;
  • Linux/Mac/Windows/Raspberry pi versions are available.

The main limitation of the 32 Bit Personal Edition and, more generally, of any 32-bit program, is that it can only ever use up to 4 GB of memory. That's due to the 32-bit address space, since 2^32 = 4,294,967,296 bytes. For some use cases this may be a serious limitation.

The 64 Bit Personal Edition (On-Demand):

  • requires "always on" internet connection;
  • is permitted to run on-premises;
  • is compatible with KX Developer and KX Dashboards Direct;
  • provides access to KX Fusion interfaces and integrations;
  • provides access to community support;
  • gives regular access to upgrades;
  • Linux/Mac/Windows versions are available.

The 32 Bit Personal Edition can be downloaded immediately, whereas for the 64 Bit Personal Edition (On-Demand) you would need to request a license. Both editions are available via

Installing kdb+/q

Kdb+/q can be installed on Linux, macOS, or Windows.

There are three installation scenarios:

  • You are a commercial user, with a k4.lic file.
  • You have the 64 Bit Personal Edition On Demand for non-commercial use. This 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 32 Bit Personal Edition for non-commercial use. It does not require a license-key file.

The first step is to download kdb+/q from

Once you have downloaded the archive, unzip it to:

  • ~/q on Linux;
  • ~/q on macOS;
  • C:\q on Windows.

Here ~ represents your HOME directory.

You can use the command line to unzip the archive. On Linux:

unzip -d $HOME/q

On macOS:

unzip -d $HOME/q

On Windows (PowerShell):

Expand-Archive -DestinationPath C:\q

It is possible to install kdb+/q to another directory, however, if you install it to a different directory from the ones listed above, you need to set the QHOME environment variable to point to that directory. You can install kdb+ anywhere as long as you set the path in QHOME.

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

Thus you end up with the following directory structure:

  • C:\ (for example)
    • q
      • w32 (or w64, or l32, etc.)
        • q.exe
      • q.k
      • q.q
      • README.txt
      • s.k
      • sp.q
      • trade.q

Installing the license file

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

Then you will end up with the following directory structure:

  • C:\ (for example)
    • q
      • w32 (or w64, or l32, etc.)
        • q.exe
      • kc.lic
      • q.k
      • q.q
      • README.txt
      • s.k
      • sp.q
      • trade.q

By default, kdb+/q looks for a license file in QHOME. To keep your license file elsewhere, set its path in the environment variable QLIC.

Tips and tricks

Running 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

For more details on how to run 32-bit programs on Ubuntu 64-bit, see


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.

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.)

It is straightforward to "wrap" the q process into rlwrap:

rlwrap ~/q/l64/q


If your machine has many cores, you may encounter the following error:

'licence error: cores

This means you are trying to run kdb+/q on a machine with two many cores. The number of licensed cores appears in parentheses in the message that appears when you launch kdb+/q. For example:

KDB+ 4.0 2020.05.04 Copyright (C) 1993-2020 Kx Systems
l64/ 72(16)core 1029691MB paul ...

This means that kdb+/q is running on a machine with 72 cores, but only 16 of them are covered by the license.

In this situation you have to restrict the cores visible to the kdb+/q process using taskset. According to the documentation,

taskset is used to set or retrieve CPU affinity of a running process given its PID or to launch a new COMMAND with a given CPU affinity. CPU affinity is a scheduler property that "bonds" a process to a given set of CPUs [or CPU cores] on the system. The Linux scheduler will honour the given CPU affinity and the process will not run on any other CPUs.

For example, we could run the q process as follows:

rlwrap taskset -c 0,1,2,3,4,5,6,7,8,9,10,11 ~/q/l64/q

In our example, this will force kdb+/q to use only the cores from 0 to 11 (inclusive) and will resolve the "cores" error.

Confirming success

Confirm that kdb+/q is working: launch your first q session. On Windows:

cd C:\q\w32

On Linux:

cd ~/q

The q session opens with a banner like this:

KDB+ 3.6 2019.04.02 Copyright (C) 1993-2019 Kx Systems
w32/ 8()core 4095MB paul desktop-efq7tt8 NONEXPIRE

Try your first expression:


End the q session and return to the command shell.

Integrated development environments (IDEs)

There is no one-size-fits-all IDE for kdb+/q. Therefore we recommend that the reader download some/all of the tools listed above and give them a try.

Q Insight Pad (Windows-only)

Q Insight Pad (sometimes referred to simply as qPad) by Oleg G. Zakharov is a kdb+ client, written in C++ to run under Windows; as a result, it is fast, memory-efficient and easy to use. The author makes a special emphasis on providing a Windows-style GUI that is visual, simple and intuitive.

Q Insight Pad provides simple but useful visualization capabilities.

An unregistered but fully functional version (working with free versions of q) can be downloaded for free from

This version expires every 3 months. If you want to license Q Insight Pad for use in your organization, contact the author:

Connecting Q Insight Pad to kdb+/q

Start a kdb+/q session. Open a port, for example, 41822:

q)\p 41822

You can now connect to this port from Q Insight Pad.

Right-click on "KDB+ Servers". Click on "Add...". Give the server a descriptive name, e.g. "Local". Set the Server to localhost and the port to 41822.

Click on "Test". You should see "Successfully connected to `:localhost:41822::.

Click "OK".

Double-click on the new server, which should now appear under "KDB+ Servers".

In the text editor, enter an expression that you would like to evaluate, e.g.


Select that expression and press Ctrl + E. The result


should appear under "Output".


qStudio by TimeStored is an intelligent code editor for kdb+/q that provides:

  • q syntax highlighting;
  • q code completion;
  • ability to query servers direct from the editor;
  • server browser for viewing server objects;
  • charts for displaying your data;
  • database management tools to modify your database structure;
  • a data loader for importing large data files easily;
  • language programming tools to increase programmer productivity:
    • qDoc for generating HTML documentation;
    • qUnit — a unit testing framework for kdb.

qStudio can be downloaded from

qStudio Pro can be purchased from

This application requires a Java Runtime Environment 1.8.0_66 or above.

Studio for kdb+

Studio for kdb+ is a rapid development environment for kdb+. In the style of commonly used SQL clients, it allows you to

  • connect to kdb+ processes;
  • execute selected text from the editor window;
  • view results as tables, charts, or classic console style.

The editor component is based on the NetBeans editor component, and includes the following features:

  • find/search/replace;
  • cut/copy/paste;
  • undo/redo;
  • syntax highlighting for the q language;
  • most recent files menu.

Additionally, the application features:

  • export to Excel;
  • drag and drop;
  • immediate charting of grid data.

Studio for kdb+ is free, provided under the Apache 2 license, and can be downloaded from

The program is portable and comes in the form of a JAR file. You need the Java runtime environment (JRE) to run it:

java -jar studio.jar

KX Developer

KX Developer is a visual environment used to manage, manipulate, and explore massive datasets in real-time by exploiting kdb+'s server-based analytics technology.

The Developer is comprised of the following components:

  • Workspace — local and shared repository for managing entities;
  • Importer — import datasets into the workspace;
  • Exporter — export datasets into other systems;
  • Visual Inspector — visualize massive datasets in real-time or near-real-time;
  • Interactive editor — write applications using the q programming language;
  • Debugger — debugger dramatically increases productivity;
  • Code Differ — compare multiple versions of the functions or modules.

Contained within the KX Developer package is a set of highly useful q developer libraries and scripts for use outside of the KX Developer UI and for automated build systems. The libraries contained provide support for:

  • Code coverage;
  • Data visualization;
  • Documentation generation from source annotations;
  • Property-based testing;
  • Q static linting and syntax checker;
  • Regular expressions;
  • Run time and memory profiling;
  • Unit testing;
  • KX Developer module to q script conversion.

KX Developer can be downloaded for free from

Note that KX Developer requires a 64-bit version of kdb+/q.