Dr Manhattan
Dr Manhattan

Reputation: 14087

How do you install timescaledb on MAC OS M1 (apple Silicone) if you have the postgress.app installed

Edit: I know it’s easier using homebrew if you have postgres installed via homebrew, but i wanted to keep my Postgress.app setup for other reasons

How do you install timescaledb on Apple Sillicone M1 Chip?

I am getting this error

tsdb=# CREATE EXTENSION IF NOT EXISTS timescaledb;
ERROR:  could not open extension control file "/Applications/Postgres.app/Contents/Versions/14/share/postgresql/extension/timescaledb.control": No such file or directory

After following instructions on

https://docs.timescale.com/install/latest/self-hosted/installation-macos/#install-self-hosted-timescaledb-using-homebrew

Upvotes: 0

Views: 3092

Answers (3)

Greg
Greg

Reputation: 2609

@DrManhattan. Thank you for your detailed instructions. Even a year later, the official instructions are confusing. Easy to get lost in the ifs (Brew, self-hosted, etc). Also confusing is macOS system level, Postgres, and the Rails app I'm working on. I originally was confused where to run the commands. But decided that at macOS root made the most sense.

Minor notes to those following this: Step 3.3 is in psql which you get to with psql on the command line or probably can do in PGAdmin.

Like the OP I wanted to continue with the app rather than Homebrew which I prefer for most uses. Will look into Docker if I keep having issues.

Upvotes: 0

Dr Manhattan
Dr Manhattan

Reputation: 14087

This question was not on Stack Overflow So I decided to ask it and answer it

Step 1: Make sure you have the latest postgress.app installed

You need to have at least postgres v14 of the postgress.app, if you dont you will get this error

ld: can't link with a main executable file '/Applications/Postgres.app/Contents/Versions/13/bin/postgres' for architecture arm64

because older versions used only intel

Step 2: Follow the instructions for homebrew

Use the instructions here

but when you get to this step timescaledb-tune --quiet --yes you start following my isntructions

Step 3: My instructions

step 3.1

Since the homebrew method expects to use homebrew postgres you have to point the tune command to postgress.app config file instead by running this

timescaledb-tune --yes --conf-path="/Users/tawanda/Library/Application Support/Postgres/var-14/postgresql.conf"

replace var-14 with your version of postgres if later

step 3.2

manually run your own setup as below because the script that comes with timescale wont work for your posgresss.app use case

/usr/bin/install -c -m 755 $(find /opt/homebrew/Cellar/timescaledb/2.7.2/lib/timescaledb/postgresql/ -name "timescaledb*.so")  /Applications/Postgres.app/Contents/Versions/14/lib/postgresql

/usr/bin/install -c -m 644 /opt/homebrew/Cellar/timescaledb/2.7.2/share/timescaledb/* /Applications/Postgres.app/Contents/Versions/14/share/postgresql/extension/

replace version 14 and version 2.7.2 with your postgress and timescale versions respectively if later

step3.3

initialise the extension

tawanda=# CREATE database tsdb;
    
tawanda=# \c tsdb;

tsdb=# CREATE EXTENSION IF NOT EXISTS timescaledb;
WARNING:
WELCOME TO
 _____ _                               _     ____________
|_   _(_)                             | |    |  _  \ ___ \
  | |  _ _ __ ___   ___  ___  ___ __ _| | ___| | | | |_/ /
  | | | |  _ ` _ \ / _ \/ __|/ __/ _` | |/ _ \ | | | ___ \
  | | | | | | | | |  __/\__ \ (_| (_| | |  __/ |/ /| |_/ /
  |_| |_|_| |_| |_|\___||___/\___\__,_|_|\___|___/ \____/
               Running version 2.7.2
For more information on TimescaleDB, please visit the following links:

 1. Getting started: https://docs.timescale.com/timescaledb/latest/getting-started
 2. API reference documentation: https://docs.timescale.com/api/latest
 3. How TimescaleDB is designed: https://docs.timescale.com/timescaledb/latest/overview/core-concepts

Note: TimescaleDB collects anonymous reports to better understand and assist our users.
For more information and how to disable, please see our docs https://docs.timescale.com/timescaledb/latest/how-to-guides/configuration/telemetry.

CREATE EXTENSION

Upvotes: 5

Calder White
Calder White

Reputation: 1326

An easy solution I use is to run timescaledb in docker, specifically with docker compose. This allows you to keep all your data in a docker volume so you can move your DB from computer to computer and also set the ports, passwords, etc. from your docker-compose.yml file.

Here is the docker-compose.yml file I use to run my local timescaledb instance:

version: "3"

# special port for timescaledb: 5445
services:
  timescaledb:
    image: timescale/timescaledb:latest-pg14
    ports:
      - "5445:5432"
    environment:
      - POSTGRES_PASSWORD=XXXXXXXXXXXXXX
    restart: always
    volumes:
      - type: bind
        source: ./timescaledb-data
        target: /var/lib/postgresql/data
    logging:
      driver: "json-file"
      options:
        max-size: "1000k"
        max-file: "5"
        compress: "true"

NOTE: I map the timescaledb port to 5445 because I also have postgres running on my system. This allows me to keep postgres running for other applications that require it while still accessing timescaledb.

Upvotes: 0

Related Questions