PostgresApp:Mac 上快速部署、安装、运行 PostgreSQL 服务器的应用(Swift)

2016-12-26 09:27:53来源:作者:Github人点击 Version 2

This is a complete rewrite of

Modern User Interface Improved Error Messages & Status Reporting Run Multiple Versions of PostgreSQL simultaneously Written in Swift!

If you are looking for the current/old version of, please switch to the pg9X branches!

Most of this README is outdated and needs to be updated for the new version.


You can download from the website.

Older versions and pre-releases are available in the releases section on GitHub.


Documentation is available at, as well as from the "Open Documentation" menu item in

What's Included? PostgreSQL PostGIS plv8 How To Build

Note: This section is outdated

If you want to tweak the GUI only, just make sure you have a compiled copy of in your applications folder. Open the XCode file and start hacking!

If you want to build your own versions of all the PostgreSQL binaries, you have a bit more work.

Make sure you have autoconf, automakeinstalled. The quickest way to install them is using MacPorts:

sudo port install autoconf automake

For building PostgreSQL with docs, you also need a bunch of other tools:

sudo port install docbook-dsssl docbook-sgml-4.2 docbook-xml-4.2 docbook-xsl libxslt openjade opensp

Then make sure you remove other versions of Postgres.appfrom your Applications folder.

Open the srcdirectory and type make. This will download and build PostgreSQL, PostGIS, and PLV8. Several hundred megabytes of sources will be downloaded and built. This can take an hour or longer, depending on your Internet connection and processor speed. All the products will be installed in /Applications/

Once this is done, you can just open Postgres.xcodeprojin Xcode, select the "Postgres" scheme, and click "Build".

To share your build, use the "Archive" command and then use the "Distribute" command in Organizer.

Under the Hood bundles the PostgreSQL binaries inside the application package. When you first start, here's what it does:

Initialise a database cluster: initdb -D DATA_DIRECTORY -EUTF-8 --locale=XX_XX.UTF-8 Start the server: pg_ctl start -D DATA_DIRECTORY -w -l DATA_DIRECTORY/postgres-server.log Create a user database: createdb USERNAME

On subsequent app launches, only starts the server.

The default DATA_DIRECTORYis /Users/USERNAME/Library/Application Support/Postgres/var-9.X

Note that runs the server as your user, unlike other installations which might create a separate user named postgres.

When you quit, it stops the server using the following command:

pg_ctl stop -w -D DATA_DIRECTORY Command Line Utilities also includes useful command line utilities:

PostgreSQL: clusterdb createdb createlang createuser dropdb droplang dropuser ecpg initdb oid2name pg_archivecleanup pg_basebackup pg_config pg_controldata pg_ctl pg_dump pg_dumpall pg_receivexlog pg_resetxlog pg_restore pg_standby pg_test_fsync pg_test_timing pg_upgrade pgbench postgres postmaster psql reindexdb vacuumdb vacuumlo PROJ.4: cs2cs geod invgeod invproj nad2bin proj GDAL: gdal_contour gdal_grid gdal_rasterize gdal_translate gdaladdo gdalbuildvrt gdaldem gdalenhance gdalinfo gdallocationinfo gdalmanage gdalserver gdalsrsinfo gdaltindex gdaltransform gdalwarp nearblack ogr2ogr ogrinfo ogrtindex testepsg PostGIS: pgsql2shp raster2pgsql shp2pgsql

See the documentationfor more info.


If you find a bug, pleaseopen an issue. is maintained byJakob Egger andChris Pastl.

License is released under the PostgreSQL License. See LICENSE for additional information.