SequelPG

Getting Started

SequelPG is a free, lightweight, native PostgreSQL client for macOS, built with SwiftUI and AppKit. The current release is v0.4.0 and requires macOS 14.4 (Sonoma) or later. Download a pre-built .app from the download page or build from source with Xcode 15+.

On first launch the start page lists your saved connections. Add one with the + button. The app follows your system Light/Dark setting out of the box; pick a fixed mode from View ▸ Appearance if you prefer.

Connections

Click + on the start page to add a connection. Profiles are stored in UserDefaults; passwords live in the macOS Keychain (cached in memory after the first read so you aren't re-prompted when opening more tabs).

FieldDescription
HostThe hostname or IP address of your PostgreSQL server.
PortThe port (default 5432).
DatabaseThe database name to connect to. Once connected you can expand other databases in the Navigator without disconnecting.
UsernameYour PostgreSQL role.
PasswordStored in macOS Keychain under SequelPG:<uuid>.
SSL ModeOne of five modes: Off, Prefer, Require, Verify CA, or Verify Full — mapping to libpq’s disable, prefer, require, verify-ca, and verify-full. Prefer and Require verify the server certificate unless Don’t verify server certificate is on (encrypted, identity not checked — for self-signed servers). CA Certificate sets a CA file to verify against instead of the system trust store; it’s also used for export and import.

Test validates the credentials without disturbing the active session. Connect opens a session in the current window; the window title then shows the connection and database you’re working in.

SSH Tunnels

For databases behind a firewall or bastion, expand the SSH Tunnel section in the connection form. SequelPG shells out to the system ssh binary, allocates a free local port, and tears the tunnel down on disconnect.

FieldDescription
SSH HostHostname or IP of the bastion.
SSH PortSSH port (default 22).
SSH UsernameLogin name on the bastion.
AuthenticationEither a key file or a password.
Key FilePath to a private key (e.g. ~/.ssh/id_ed25519).
SSH PasswordStored separately in Keychain under SequelPGSSH:<uuid> and supplied to ssh via SSH_ASKPASS.

Tabs & Windows

SequelPG uses native macOS window tabs. Press ⌘T to open a new tab in the current window or ⌘N for a new window. Each tab or window carries its own connection, navigator state, and mode, so you can connect different profiles side by side and switch between them without disconnecting. Closing a tab or window disconnects its session.

The Connections menu in the toolbar, next to the connection name, opens any saved connection in a new tab (already connected), starts a New Connection Tab, or disconnects. The same saved connections are under File → Open Connection in New Tab.

Edit Connection… (File menu or the Connections menu) edits the connection the window is using, in the same form as the start page. Save keeps the current session running; Save & Reconnect applies the change immediately.

Each window is a split view: the Navigator sidebar on the left (collapse it with ⌃⌘S), the workspace in the middle, and the native Inspector on the right (⌥⌘I). The toolbar’s mode switcher picks what the workspace shows: ⌘1 Structure, ⌘2 Content, ⌘3 Definition, ⌘4 Query, and ⌘5 Diagram. The mode is sticky — select another object in the sidebar and you stay in the mode you were using.

Structure

The Structure mode (⌘1) shows the schema of the selected object. For tables this includes column name, data type, nullable status, default value, and a type indicator for each column.

Sub-sections below the columns list indexes (with btree / hash / partial / unique tags), constraints (PK, FK, CHECK, UNIQUE), triggers, and partitions when applicable.

Content

The Content mode (⌘2) is a native AppKit grid (DataGridView) with type-aware cell rendering, vertical cell dividers, column sorting, and multi-select. Numeric, money, inet, cidr, macaddr, jsonb, and composite types are decoded from PostgreSQL's binary wire format for accuracy and speed.

Rows are paginated at 50 / 100 / 200 per page. Approximate row counts come from pg_class.reltuples (with a fallback to COUNT(*) when the planner stat is missing). Very long text values are truncated for display at 10,000 characters to keep the grid responsive.

Editing

Double-click a cell to open a type-aware editor sheet — JSON, arrays, booleans, and long text each get a suitable editor — and the change is saved as soon as you confirm it. The selected row can also be edited field by field in the Inspector. Insert row opens a form with per-column type and default hints; Delete row prompts for a cascade option when a foreign key would otherwise block the delete.

Filtering

Press ⌘F (Edit ▸ Find) to toggle the filter bar above the grid. Pick a column, an operator (=, ≠, ~, IS NULL, etc.), and a value; SequelPG previews the generated WHERE clause so you can verify the SQL before applying it.

Definition

The Definition mode (⌘3) is a read-only DDL/source viewer for non-table objects — views, materialized views, functions, procedures, sequences, types, and domains. The full CREATE statement is shown with SQL syntax highlighting and selectable for copy-out.

Query

The Query mode (⌘4) is the SQL editor + results pane. Write a statement and press ⌘↩ (or Query ▸ Run Query) to execute. A script with several statements runs them in order, stops at the first error, and shows the last statement’s result; data changes report how many rows were affected. Results render in the same AppKit grid as the Content mode. A status bar under the grid shows the row count, a notice when the 2,000-row result cap kicks in, the execution time, and an Export menu (see Export Results). Server notices land in the Messages tab, and errors appear in a banner you can dismiss.

Press ⌘. (Stop) to cancel a running statement — the cancel is sent to the server, so the query really stops rather than just being abandoned by the client. Every query also runs under a server-side statement_timeout: 10 seconds by default, adjustable in Settings ▸ Editor from 5 seconds to 5 minutes, or No limit.

Other Query menu actions: Explain (⌥⌘E) and Explain Analyze (⌥⇧⌘E) hand off to the EXPLAIN visualizer; Beautify (⇧⌘F) reformats the query; Clear Query (⌘K) resets the editor. When a SELECT returns zero rows the grid still renders the column headers — resolved from table metadata — so the result schema is always visible.

SQL Editor

Syntax Highlighting

Keywords, identifiers, strings, comments, numbers, operators, and type names are colored to suit the current appearance. Highlighting runs on every edit through a custom NSTextStorage tokenizer. The editor font (SF Mono, JetBrains Mono, or Menlo at 10–20 pt) is set in Settings ▸ Editor, and ⌘F opens the native find bar inside the editor.

Autocompletion

Suggestions fire after 2 characters and rank JetBrains-style: prefix matches always beat fuzzy matches (typing sele always lands on SELECT, never SECURITY), with case-insensitive fuzzy fallback for partials like usp → user_profile. The top confident match is pre-selected so Tab / ↩ commits without arrow-down.

The popup is context-aware: a lightweight pass over the tokens preceding the cursor figures out the clause and biases the candidate pool. After FROM / JOIN / UPDATE / INSERT INTO it favors tables and views; after SELECT / WHERE / ON / GROUP BY / ORDER BY / SET / RETURNING it favors columns. A qualifier (users.email) restricts columns to that table. In DDL, the object a statement acts on outranks keywords — typing DROP SCHEMA … ranks your schema names above VACUUM.

The popup is a purpose-built, JetBrains-style panel rather than the native macOS list: each row carries a kind chip (keyword, table, column, schema, function), the characters you’ve typed are bolded in the accent color, and a type detail sits on the right. ↑ / ↓ move through the list, and you can click a row to accept it; accepting leaves the caret at the end of the inserted text with nothing selected. Prefer to type without interruptions? Turn off “Suggest completions while typing” in ⌘, Settings ▸ Editor — the popup then only appears when you ask for it with ⎋ or ⌃Space.

Beautify

Beautify (⇧⌘F) reformats the buffer with proper indentation and line breaks. It also auto-quotes mixed-case identifiers so queries against case-sensitive tables and columns keep working without manual "...".

EXPLAIN Visualizer

Two Query menu commands surface PostgreSQL's plan information without leaving the app:

  • Explain (⌥⌘E) — runs EXPLAIN (no execution, no impact on production data) and shows the predicted plan.
  • Explain Analyze (⌥⇧⌘E) — runs EXPLAIN (ANALYZE, BUFFERS) and shows what actually happened, including row estimates vs. actuals and buffer counters.

Results render as a vertical tree of plain-English steps — "Read the whole orders table," "Match rows using a hash table," "Sort by created_at" — with a one-sentence summary, a metrics row (took / returned / loops / cost), and findings chips that flag bad row estimates, dominant time hogs, filter waste, and Nested-Loop-over-Seq-Scan anti-patterns. A right-side detail card exposes the raw PostgreSQL fields (Sort Method, Hash Cond, buffer counters, etc.) for anyone who wants them. Large plans are read in full — the 10,000-character cell display limit doesn’t apply to EXPLAIN output.

Diagram

The Diagram mode (⌘5) draws an interactive entity-relationship diagram of a schema: tables with their columns, connected by their foreign keys. Pick the schema from the picker in the diagram toolbar.

  • Auto Layout arranges the tables for you; drag any table to place it yourself.
  • Zoom in and out, fit the whole diagram to the window, or reset to 100%. Hide tables you don’t need and bring them back with Show All.
  • Your layout — positions, hidden tables, and viewport — is saved per connection and schema, so the diagram looks the same next time you open it.
  • Export… saves the diagram as PNG, SVG, or PDF.

Export Results

Any grid of rows can be saved to a file. Open the Export menu in the Query results status bar or in the Content mode’s pagination bar and choose CSV or JSON. The file matches what you see on screen, including the current sort order.

Query History

Toggle the bottom history panel with ⇧⌘Y (View ▸ Query History). Every statement — including the system queries SequelPG runs on your behalf — is logged with timestamp, duration, row count, and a success indicator, plus the error message when a statement fails. Filter the list to All, Mine, or System, and use the eye toggle to hide literal values in system-issued DML.

Each entry has buttons to copy the SQL, open it in the query editor, or — for your own queries — run it again. The trash button clears the history.

Object Creation

Right-click a category in the Navigator (e.g. Tables, Views) for a Create… action, or use Database ▸ New Database… / New Schema…. Sheets are available for:

  • Databases and schemas
  • Tables and views
  • Functions and sequences
  • Types and domains
  • Indexes (B-tree, hash, partial, unique)

Sheets generate the underlying DDL — you can inspect or edit it before submitting. Drops are available from the same context menu with a confirmation dialog.

Schema Editing

On the Structure mode for a table you can add columns, and double-click a column to rename it, change its type, or toggle the NOT NULL flag. Right-click a column to drop it. Each action runs the corresponding ALTER TABLE, with the SQL visible in Query History after the fact.

Database Tools

The Database tools menu in the toolbar and the Database menu in the menu bar open database-level tools:

  • Extensions… — install, drop, or upgrade PostgreSQL extensions (pg_trgm, pgcrypto, uuid-ossp, etc.).
  • Roles & Privileges… — browse roles, group memberships, and grants.
  • Function Library… — a searchable reference of built-in PostgreSQL functions with a Run dialog for ad-hoc invocation.

The Database menu also holds Refresh (⌘R) to reload schemas and objects, and Disconnect (⇧⌘W).

Database Export & Import

Export Database… (⇧⌘E, in the File menu and the Database tools toolbar menu) runs pg_dump against the connected database — SSH tunnels included. Choose a format (Plain SQL, Custom, Directory, or Tar archive), schema + data, schema only, or data only, all schemas or a selection, and the usual pg_dump options (--no-owner, --clean, --if-exists, --create, --inserts, and more). Progress streams live in the sheet. Custom, directory, and tar archives are restored outside the app with the pg_restore command-line tool.

Import SQL File… (⇧⌘I) runs a .sql file — such as a plain-SQL export — through psql. Two safety switches are chosen per import: Run in a single transaction (any error rolls everything back) and Stop on first error.

Both use your installed PostgreSQL client binaries. SequelPG auto-detects Postgres.app, Homebrew, and the EDB installer; to use a different install, point Settings ▸ Tools at its bin directory.

AI Assistants (MCP)

SequelPG is a Model Context Protocol server. Claude Code, Claude Desktop, Cursor, VS Code and other MCP clients can list the connections you share, browse databases, schemas and objects, describe tables, read DDL, and run read-only queries and EXPLAIN plans. Passwords stay in your Keychain.

  • Turn it on in Settings → MCP and click Add next to your client, or copy the JSON config.
  • Share a connection by setting MCP Access in its AI Assistants section to Read-only (Off by default).
  • SequelPG asks before each new client uses your connections.
  • Queries are a single SELECT-style statement in a rolled-back read-only transaction with a 30-second timeout; superuser roles are refused unless the connection allows them.

The MCP setup guide covers creating a read-only role, every client, the tools, limits and troubleshooting.

Inspector

Toggle the native Inspector on the right with ⌥⌘I or the toolbar button. Its contents change with context:

  • When a table is selected — object name, approximate row count, column count, and a list of indexes / constraints.
  • When a row is selected in Content mode — every field with its raw value and a type-aware editor (JSON formatter, array editor, boolean toggle, long-text textarea).

Appearance

SequelPG looks and feels like a Mac app: it uses the system’s semantic colors, SF Pro and SF Mono, standard macOS controls, and your chosen accent color. Pick a mode from View ▸ Appearance or Settings ▸ General:

  • Auto (System) — follow the system Light/Dark setting and switch live when macOS toggles.
  • Light — always light.
  • Dark — always dark.

The window chrome, SQL editor, syntax highlighter, and results grid all follow the selected mode. Your choice is saved per-user and survives restarts.

Settings

Open Settings with ⌘,. It has four tabs:

  • General — Appearance (Auto / Light / Dark).
  • Editor — the editor font (SF Mono, JetBrains Mono, or Menlo, 10–20 pt), the “Suggest completions while typing” toggle, and the query timeout (5 seconds, 10 seconds, 30 seconds, 1 minute, 5 minutes, or No limit).
  • Tools — the directory holding your PostgreSQL client binaries (leave empty to auto-detect), with a check showing whether pg_dump and psql were found.
  • MCP — the MCP server switch and status, client setup, shared connections and allowed clients. See AI Assistants (MCP).

Keyboard Shortcuts

ShortcutAction
⌘TNew Connection Tab (native window tab).
⌘NNew Connection Window.
⌘1 – ⌘5Switch between Structure / Content / Definition / Query / Diagram.
⌃⌘SShow or hide the Navigator sidebar.
⌥⌘IShow or hide the Inspector.
⇧⌘YToggle the Query History panel.
⌘RRefresh schemas and objects.
⇧⌘WDisconnect and return to the start page.
⌘↩Run the current SQL query.
⌘.Stop the running query (cancelled on the server).
⌥⌘EExplain the current query.
⌥⇧⌘EExplain Analyze the current query.
⇧⌘FBeautify the SQL in the editor.
⌘KClear the query editor.
⌘FToggle the filter bar in Content mode; open the find bar in the SQL editor.
⇧⌘EExport the database with pg_dump.
⇧⌘IImport a SQL file with psql.
⌘,Open Settings.
↑ / ↓Navigate between rows in Content mode.
⎋ or ⌃SpaceManually invoke the SQL autocomplete popup (it also fires automatically after 2 characters, unless you've turned that off in Settings).

Known Limitations

  • No client certificates for SSL authentication (a custom CA file is supported).
  • No CSV import (CSV/JSON export of result rows is available).
  • No editing UI for triggers or procedures — they’re view-only in the Definition mode.
  • No schema diff.