# Install and update pgwire

_This page explains where the KDB-X installer puts pgwire, and how to install or update it yourself from the KX downloads portal._

pgwire is a single executable, `pg` (`pg.exe` on Windows). It connects PostgreSQL clients to a q process that has loaded the [SQL interface](../sql/introduction.md).

## Installed by default

The [KDB-X installer](../../get_started/kdb-x-install.md) downloads the latest pgwire release and places `pg` in `bin/` in your installation directory, which defaults to `$HOME/.kx`. That folder is already on your `PATH`, so you can run `pg` from any directory. You do not need to install it separately after a standard installation.

> **Note — Linux ARM**
>
> pgwire is not available for Linux ARM (aarch64), so the installer skips it on that platform.
>
## Install or update manually

Install manually when you want a newer pgwire release than the one your installer shipped.

### Before you begin

- Know your KDB-X installation directory, if you are updating an existing installation. The default is `$HOME/.kx`. The commands below use that path. If you installed KDB-X elsewhere, replace it with your installation directory.

### 1. Download the archive

Download the archive for your platform from the [SQL directory in the KX downloads portal](https://portal.dl.kx.com/assets/raw/kdb-x/sql/). pgwire ships in the same archive as the SQL interface. The `~latest~` path always points at the newest release. Each archive contains `pg`, `s.k_`, a `readme` and a `changelog`.

| **Archive** | **Platform** | **Executable** |
|---|---|---|
| `l64-sql.zip` | Linux x86-64 | `pg` |
| `m64-sql.zip` | macOS (Intel and Apple Silicon) | `pg` |
| `w64-sql.zip` | Windows | `pg.exe` |

=== "Linux"
    ```bash
    curl -L -O https://portal.dl.kx.com/assets/raw/kdb-x/sql/~latest~/l64-sql.zip
    ```
=== "macOS"
    ```bash
    curl -L -O https://portal.dl.kx.com/assets/raw/kdb-x/sql/~latest~/m64-sql.zip
    ```
=== "Windows"
    Download [w64-sql.zip](https://portal.dl.kx.com/assets/raw/kdb-x/sql/~latest~/w64-sql.zip) in your browser.

To install a specific version instead, replace `~latest~` with the version number, for example `1.2.3`.

### 2. Extract and copy the executable

Extract the archive, then copy `pg` into `bin/` in your installation directory. Copying over the existing file updates it.

=== "Linux"
    ```bash
    unzip -q l64-sql.zip -d sql
    cp sql/pg "$HOME/.kx/bin/"
    chmod +x "$HOME/.kx/bin/pg"
    ```
=== "macOS"
    ```bash
    unzip -q m64-sql.zip -d sql
    cp sql/pg "$HOME/.kx/bin/"
    chmod +x "$HOME/.kx/bin/pg"
    ```
=== "Windows"
    Extract the archive and run `pg.exe` from the extracted folder, or copy it to a folder on your `PATH`.

The same archive contains the SQL interface. To update it at the same time, follow [Install and update SQL](../sql/install.md).

### 3. Verify the installation

Run `pg` with no arguments. It prints its version and usage:
```bash
$ pg
pg 2026.10.20 (c api 20201125) Copyright (C) 1993-2026 Kx Systems
Usage: pg [-T kdb_timeout][-I interface][-v] listen_port kdb_host kdb_port
```

## Next steps

- Connect a PostgreSQL client with the [pgwire quickstart](quickstart.md).
- Check the [pgwire settings](reference.md) and command-line flags.
- Read what changed in each release in the [SQL release notes](../sql/release-notes/changelog.md), which cover pgwire too.
