# TDS Foreign data wrapper * **Author:** Geoff Montee * **Name:** tds_fdw * **File:** tds_fdw/InstallOSX.md ## Installing on OSX This document will show how to install tds_fdw on OSX using the [Homebrew](https://brew.sh/) package manager for the required packages. ### Install FreeTDS The TDS foreign data wrapper requires a library that implements the DB-Library interface, such as [FreeTDS](http://www.freetds.org). ```bash brew install freetds ``` Note: If you install FreeTDS from another source, e.g. [MacPorts](https://www.macports.org), you might have to adjust the value for `TDS_INCLUDE` in the make calls below (e.g. `-I/opt/local/include/freetds` for MacPorts). ### Install PostgreSQL If you need to install PostgreSQL, do so by following the [apt installation directions](https://wiki.postgresql.org/wiki/Apt). For example, to install PostgreSQL 9.5 on Ubuntu: ```bash brew install postgres ``` Or use Postgres.app: ### Install tds_fdw #### Build from release package If you'd like to use one of the release packages, you can download and install them via something like the following: ```bash export TDS_FDW_VERSION="2.0.5" wget https://github.com/tds-fdw/tds_fdw/archive/v${TDS_FDW_VERSION}.tar.gz tar -xvzf v${TDS_FDW_VERSION}.tar.gz cd tds_fdw-${TDS_FDW_VERSION} make USE_PGXS=1 TDS_INCLUDE=-I/usr/local/include/ sudo make USE_PGXS=1 install ``` **NOTE:** If you have several PostgreSQL versions and you do not want to build for the default one, first locate where the binary for `pg_config` is, take note of the full path, and then append `PG_CONFIG=` after `USE_PGXS=1` at the `make` commands. #### Build from repository If you would rather use the current development version, you can clone and build the git repository via something like the following: ```bash git clone https://github.com/tds-fdw/tds_fdw.git cd tds_fdw make USE_PGXS=1 TDS_INCLUDE=-I/usr/local/include/ sudo make USE_PGXS=1 install ``` **NOTE:** If you have several PostgreSQL versions and you do not want to build for the default one, first locate where the binary for `pg_config` is, take note of the full path, and then append `PG_CONFIG=` after `USE_PGXS=1` at the `make` commands. #### Start server If this is a fresh installation, then start the server: ```bash brew services start postgresql ``` Or the equivalent command if you are not using Homebrew. #### Install extension ```bash psql -U postgres postgres=# CREATE EXTENSION tds_fdw; ```