Skip to content

vapor-community/cpostgresql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CPostgreSQL

This package is a system module wrapper for libpq – the official C library for PostgreSQL –, which must be installed separately before using it in Swift projects.

Note: the database itself does not need to be running, only the header and library files matter.

Choose one of the following options:

macOS: Install PostgreSQL via Homebrew (preferred)

  1. Visit the https://brew.sh to install Homebrew if it isn't already installed.

  2. Run the following command:

    brew install postgresql pkg-config
    

macOS alternative: Install PostgreSQL with Postgres.app

  1. Download Postgres.app from postgresapp.com.

  2. Create a pkgConfig file at /usr/local/lib/pkgconfig/libpq.pc with the following content:

    path=/Applications/Postgres.app/Contents/Versions/latest
    Cflags: -I${path}/include
    Libs: -L${path}/lib -lpq
    
  3. Adjust the path as necessary.

macOS alternative: Install PostgreSQL with the EnterpriseDB installer

  1. Download and run the installer from enterprisedb.com.

  2. Create a pkgConfig file at /usr/local/lib/pkgconfig/libpq.pc with the following content:

    path=/Library/PostgreSQL/10
    Cflags: -I${path}/include
    Libs: -L${path}/lib -lpq
    
  3. Adjust the version number (10 in the example) to match the installed version.

Linux: Install PostgreSQL via apt-get

Execute the following commands as the superuser:

apt-get update
apt-get upgrade
apt-get install postgresql postgresql-contrib