Install self-hosted TimescaleDB on macOS systems

You can host TimescaleDB yourself on your Apple macOS system. These instructions use a Homebrew or MacPorts installer on these versions:

  • Apple macOS 10.15 Catalina
  • Apple macOS 11 Big Sur
  • Apple macOS 12 Monterey
important

Before you begin installing TimescaleDB, make sure you have installed PostgreSQL version 12 or later.

warning

If you have already installed PostgreSQL using a method other than Homebrew, you could encounter errors following these instructions. It is safest to remove any existing PostgreSQL installations before you begin. If you want to keep your current PostgreSQL installation, do not install TimescaleDB using this method. Install from source instead.

Install self-hosted TimescaleDB using Homebrew

You can use Homebrew to install TimescaleDB on macOS-based systems.

Installing self-hosted TimescaleDB using Homebrew

  1. Install Homebrew, if you don’t already have it:

    1. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

    For more information about Homebrew, including installation instructions, see the Homebrew documentation.

  2. At the command prompt, add the Timescale Homebrew tap:

    1. brew tap timescale/tap
  3. Install TimescaleDB:

    1. brew install timescaledb
  4. Run the timescaledb-tune script to configure your database:

    1. timescaledb-tune --quiet --yes
  5. Change to the directory where the setup script is located. It is typically, located at /opt/homebrew/Cellar/timescaledb/<VERSION>/bin/, where <VERSION> is the version of timescaledb that you installed:

    1. cd /opt/homebrew/Cellar/timescaledb/<VERSION>/bin/
  6. Run the setup script to complete installation.

    1. ./timescaledb_move.sh

When you have PostgreSQL and TimescaleDB installed, you can connect to it from your local system using the psql command-line utility.

Installing psql using Homebrew

  1. Install psql:

    1. brew install libpq
  2. Update your path to include the psql tool.

    1. brew link --force libpq

    On Intel chips, the symbolic link is added to /usr/local/bin. On Apple Silicon, the symbolic link is added to /opt/homebrew/bin.

Install self-hosted TimescaleDB using MacPorts

You can use MacPorts to install TimescaleDB on macOS-based systems.

Installing self-hosted TimescaleDB using MacPorts

  1. Install MacPorts by downloading and running the package installer. For more information about MacPorts, including installation instructions, see the MacPorts documentation.

  2. Install TimescaleDB:

    1. sudo port install timescaledb
  3. OptionalView the files that were installed:

    1. port contents timescaledb
important

MacPorts does not install the timescaledb-tools to run the timescaledb-tune script. For more information about installing and using the tool, see timescaledb-tune section.

When you have PostgreSQL and TimescaleDB installed, you can connect to it from your local system using the psql command-line utility.

Installing psql using MacPorts

  1. Install the latest version of libpqxx:

    1. sudo port install libpqxx
  2. OptionalView the files that were installed by `libpqxx`:

    1. port contents libpqxx

Set up the TimescaleDB extension

Connect to PostgreSQL from your local system using the psql command-line utility and set up the TimescaleDB extension.

Setting up the TimescaleDB extension

  1. On your local system, at the command prompt, connect to the PostgreSQL instance as the postgres superuser:

    1. psql -U postgres -h localhost

    If your connection is successful, you’ll see a message like this, followed by the psql prompt:

    1. psql (14.4)
    2. Type "help" for help.
  2. At the psql prompt, create an empty database named tsdb:

    1. CREATE database tsdb;
  3. Connect to the tsdb database that you created:

    1. \c tsdb
  4. Add the TimescaleDB extension:

    1. CREATE EXTENSION IF NOT EXISTS timescaledb;
  5. Check that the TimescaleDB extension is installed by using the \dx command at the psql prompt. Output is similar to:

    1. tsdb-# \dx
    2. List of installed extensions
    3. Name | Version | Schema | Description
    1. -------------+---------+------------+-------------------------------------------------------------------
    2. plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
    3. timescaledb | 2.7.0 | public | Enables scalable inserts and complex queries for time-series data
    4. (2 rows)

After you have created the extension and the database, you can connect to your database directly using this command:

  1. psql -U postgres -h localhost -d tsdb

Where to next

Now that you have your first TimescaleDB database up and running, you can check out the TimescaleDB section, and find out what you can do with it.

If you want to work through some tutorials to help you get up and running with TimescaleDB and time-series data, check out the tutorials section.

You can always contact us if you need help working something out, or if you want to have a chat.