# KDB-X Installation Guide

_This page describes how to install and configure KDB-X on different platforms. The installation steps are the same for both the **Community Edition** and the **Commercial Edition** — the only difference is the license and the license argument you use (see [License requirements](#license-requirements))._

## Prerequisites

### Supported platforms

The following platforms are supported:

- Linux (x86_64)
- Linux ARM (aarch64)
- macOS (Intel and Apple Silicon)
- Windows 10/11 using Windows Subsystem for Linux (WSL)

> **Note**
>
> Native Windows installation is **not** currently supported.
>
### Required tools

Ensure the following tools are available:

- `bash`
- `curl`
- `unzip`
- `pip` (optional, for KDB-X Python)

### Install dependencies

> **Note**
>
> Ensure you have access to a terminal. For example, **Command Prompt**, **Terminal app** or **Windows Subsystem for Linux (WSL)**.
>
#### Ubuntu/Debian:
```bash
sudo apt update
sudo apt install curl unzip
```

#### RHEL/CentOS:
```bash
sudo yum install curl unzip
```

#### macOS:

- `curl` is preinstalled
- `unzip` is preinstalled

> **Note**
>
> For macOS, we recommend you install [HomeBrew](https://brew.sh/){target=_blank} before installing KDB-X.
>
### License requirements

A valid license key is required for both editions. Where you obtain it depends on which edition you are installing:

- **Community Edition** — sign up at the [Developer Center](https://developer.kx.com/products/kdb-x/install). You will receive a welcome email with your base64-encoded `kc.lic` license key. When you log in to the Developer Center, your install command is generated with both your license key and bearer token automatically populated — just copy and paste it into your terminal.
- **Commercial Edition** — your `k4.lic` license is provided separately by KX. Use this license in place of the Community Edition license; all other installation steps remain the same.

The license key must be pasted exactly as provided:

- Do not add quotes
- Do not add spaces
- Do not modify formatting

## Online installation (recommended)

This method downloads and installs the latest version automatically.

The installation steps and commands are also available after logging into the [Developer Center](https://developer.kx.com/products/kdb-x/install).

### Linux / Windows (WSL)

=== "Community Edition"

    Open a Linux or WSL terminal and copy/paste the install command from the [Developer Center](https://developer.kx.com/products/kdb-x/install). The command has the following format:
    ```bash
    curl -sSLO --fail-with-body --oauth2-bearer <AUTO_POPULATED_AUTH_TOKEN> \
    https://portal.dl.kx.com/assets/raw/kdb-x/install_kdb/~latest~/install_kdb.sh && \
    bash install_kdb.sh --b64lic <AUTO_POPULATED_LICENSE_KEY>
    ```

> **Note**
>
> Your Community Edition license key (base64 encoded `kc.lic`) is automatically included in the command copied from the Developer Center.
>
=== "Commercial Edition"

    Open a Linux or WSL terminal.

    To download and install using a `k4.lic`, run:
    ```bash
    export KDB_LICENSE_K4B64=$(base64 -w 0 /path/k4.lic)
    curl -sSLO --fail-with-body \
    https://portal.dl.kx.com/assets/raw/kdb-x/install_kdb/~latest~/install_kdb.sh && \
    bash install_kdb.sh --k4b64lic $KDB_LICENSE_K4B64
    ```

### macOS

=== "Community Edition"

    Open Terminal and copy/paste the install command from the [Developer Center](https://developer.kx.com/products/kdb-x/install). The command has the following format:
    ```bash
    curl -sSLO --fail-with-body --oauth2-bearer <AUTO_POPULATED_AUTH_TOKEN> \
    https://portal.dl.kx.com/assets/raw/kdb-x/install_kdb/~latest~/install_kdb.sh && \
    bash install_kdb.sh --b64lic <AUTO_POPULATED_LICENSE_KEY>
    ```

=== "Commercial Edition"

    Open a Terminal.

    To download and install using a `k4.lic`, run:
    ```bash
    export KDB_LICENSE_K4B64=$(base64 -b 0 /path/to/k4.lic)
    curl -sSLO --fail-with-body \
    https://portal.dl.kx.com/assets/raw/kdb-x/install_kdb/~latest~/install_kdb.sh && \
    bash install_kdb.sh --k4b64lic "$KDB_LICENSE_K4B64"
    ```

If macOS blocks execution due to security controls, run the following command, then retry:
```bash
xattr -rd com.apple.quarantine .
```

## Air-gapped installation

Use this method in restricted or air-gapped environments.

You need two machines to perform this installation:

- Host machine (with internet access)
- Target machine (air-gapped, no internet access)

The host machine downloads and prepares the installation bundle for the target machine.

### Prerequisites

You must generate the bundle for the target machine architecture, not the host machine.

Valid platform values:

| **Platform** | **Description**                |
| ------------ | ------------------------------ |
| `l64`        | Linux x86_64 (Intel/AMD)       |
| `l64arm`     | Linux ARM (aarch64)            |
| `m64`        | macOS (Intel or Apple Silicon) |

### On the host machine

1. Download the required assets:

    1. For Linux or macOS host:
        ```bash
        curl -sL --remote-name-all https://portal.dl.kx.com/assets/raw/kdb-x/install_kdb/~latest~/{bundle.sh,versions.csv} && \
         bash bundle.sh --platform PLATFORM
        ```

        Replace `PLATFORM` with one of:

        - `l64`
        - `l64arm`
        - `m64`

    1. For Windows host:
        ```bash
        curl.exe -LO https://portal.dl.kx.com/assets/raw/kdb-x/install_kdb/~latest~/bundle.ps1; if ($?) { curl.exe -LO https://portal.dl.kx.com/assets/raw/kdb-x/install_kdb/~latest~/versions.csv; if ($?) { .\bundle.ps1 -platform l64 } }
        ```

        Replace `l64` with the appropriate platform value.

1. Move the generated file, for example `l64-bundle.zip`, from the host machine to the air-gapped target machine using your approved transfer method (USB, secure copy, etc.).

### On the target machine

Unzip and install KDB-X offline:

=== "Community Edition"

    Open a terminal and copy/paste the air-gapped install command from the [Developer Center](https://developer.kx.com/products/kdb-x/install). The command has the following format:
    ```bash
    unzip l64-bundle.zip && bash install_kdb.sh --offline --b64lic INSERT_YOUR_LICENSE_KEY_HERE
    ```

    - Replace `l64` with the appropriate platform value.
    - Replace `INSERT_YOUR_LICENSE_KEY_HERE` with your base64 license key.

=== "Commercial Edition"

    Open a terminal.

    To install using a `k4.lic`, run:
    ```bash
    unzip l64-bundle.zip && bash install_kdb.sh --offline --k4b64lic INSERT_YOUR_LICENSE_KEY_HERE
    ```

    - Replace `l64` with the appropriate platform value.
    - Replace `INSERT_YOUR_LICENSE_KEY_HERE` with your base64 license key.

## Optional: Install KDB-X Python

Run this command to install the KDB-X Python API:
```bash
pip install --upgrade pykx
```

For more details, refer to [KDB-X Python Install](https://code.kx.com/pykx/getting-started/installing.html).

## Verify installation

To confirm KDB-X is installed correctly, run:
```bash
q
```

This command should display the installed version, build date, and environment details, in the following expected format:
```bash
KDB-X <version> <build-date>
l64/ ...
Welcome to KDB-X Community Edition!
```

For example:
```bash
KDB-X 5.0 2026.01.22 Copyright (C) 1993-2026 Kx Systems
l64/ 16(24)core 15644MB user machine 127.0.1.1 EXPIRE 2026.12.31 user@site.com COMMUNITY #12345678

Welcome to KDB-X Community Edition!
For Community support, please visit https://kx.com/slack
Tutorials can be found at https://github.com/KxSystems/tutorials
Ready to go beyond the Community Edition? Email preview@kx.com

q)
```

> **Note**
>
> The example banner above is from the Community Edition. When running the Commercial Edition, the welcome message and license details will differ, but the verification steps are the same.
>
You should now see the `q)` prompt.

To test execution, run:
```q
q)1+1
2
```

To exit the process type `\\` and hit **Enter**.

## Installation location

By default, KDB-X installs into `$HOME/.kx`. The installer:


- Places the q binary in your `PATH`
- Configures the license automatically
- Installs required runtime components
- Installs the [SQL interface](../integrations/sql/install.md) into `q/` and [pgwire](../integrations/pgwire/install.md) into `bin/`

To confirm the binary location, run:
```bash
which q
```

## What's next?

Now that you have KDB-X set up, check out the following resources:

- Read an introduction to KDB-X: [A Brief Introduction to q and KDB-X](../learn/brief-introduction.md)
- Learn with Tutorials: [KDB-X Tutorials](https://github.com/KxSystems/tutorials/tree/main/KDB-X){target=_blank}
- Boost your skills: [Enroll in KX Academy Courses](https://learninghub.kx.com/academy/){target=_blank}
- Try out one of our [KDB-X modules](../modules/module-index.md)
