/PostgresPrefs

Preference Pane for administering PostgreSQL on macOS

Primary LanguageObjective-CMIT LicenseMIT

Postgres Prefs

Contents

Overview

A Mac OS X System Preferences pane for controlling the PostgreSQL Database Server.

Features include:

  • Compatible with all PostgreSQL installations - including Homebrew and One click installer
  • Start and stop PostgreSQL Servers at the click of a button - no need for obscure commands
  • Set PostgreSQL to start automatically on computer bootup or user login
  • Easily change PostgreSQL settings in the GUI
  • Control multiple PostgreSQL servers in the same window

Main Screen

alt text

Change Settings

alt text

Log

alt text

Install Instructions

  1. Download the latest release version here
  2. Once downloaded, open the .dmg file by double-clicking it, and then either double-click the contained PostgreSQL.prefPane file, or drag it to System Preferences to install it.
  3. When installing, you will be asked if you want to install it for this user only, or for all users. Choose this user only (either option is fine however).

alt text

Uninstall Instructions

  1. Stop any running PostgreSQL servers:

    • Open System Preferences, click , select each running server in turn and click the Stop PostgreSQL button
  2. Remove PostgresPrefs from System Preferences:

    • Right-click in System Preferences, and click Remove
  3. Delete the PostgresPrefs configuration file, if it exists:

     rm ~/Library/Preferences/org.postgresql.preferences.servers.plist
sudo rm  /Library/Preferences/org.postgresql.preferences.servers.plist
  1. Delete any configuration files for starting/stopping individual PostgreSQL servers, if they exist:
     rm ~/Library/LaunchAgents/org.postgresql.preferences.*.plist
sudo rm  /Library/LaunchAgents/org.postgresql.preferences.*.plist
sudo rm  /Library/LaunchDaemons/org.postgresql.preferences.*.plist
  1. Delete the log directories containing log files for your PostgreSQL servers, if they exist:
     rm -rf ~/Library/Logs/PostgreSQL
sudo rm -rf  /Library/Logs/PostgreSQL

FAQ

  • In a nutshell, what does this tool do and what does it not do?

    It can start and stop PostgreSQL servers, show their running status, and schedule auto-startup at boot/login. It cannot install PostgreSQL, create database clusters, create databases or run SQL.

  • Can I run multiple instances of PostgreSQL on the same machine?

    Yes - this is new with Version 2! Note that each separate instance of PostgreSQL must have its own data directory and port. It is easy to specify a different port using the settings popup. But to create a separate data directory you must run the initdb command to create a new database cluster, as described in the PostgreSQL documentation.

  • PostgreSQL does not start up.

    If you clicked Start PostgreSQL, and the server is stuck with status Retrying..., the first step is to click the View Log button. This will open the default log for the server in Mac OS X's Console log-viewing application. From the log messages, it should be clear what the problem is. For example, the PostgreSQL data directory or port may already be in use by another server.

  • I have selected startup at Login/Boot, but PostgreSQL still does not startup automatically.

    First, make sure you can start the server manually using the Start PostgreSQL button. If this works ok, then please file an issue on github and we will investigate.

  • Does this tool affect my existing installations?

    The short answer is: no, Postgre Preferences creates its own configuration files for starting/stopping servers, separate from any existing installations. However, from version 2.1 onwards, Postgre Preferences automatically detects and displays already-running servers that were started/configured elsewhere. Any such 'external' servers can be started and stopped like normal servers (if a configuration file is found). If you click the - button to delete one of the external servers, you will be prompted whether you also want to delete the server's configuration file, or leave it untouched.

  • Who is Macca Tech, and why did you make this tool?

    At the moment, Macca Tech consists of just me, a developer who enjoys creating tools and apps on macOS and iOS. I created this tool partly for fun, and partly because I was using PostgreSQL and found it far too complicated to do something as simple as starting and stopping a database server!

Version History

Version Date Comments
v2.7 28-Mar 2022 Bugfix release
  • Fix issues detecting PostgreSQL if using EnterpriseDB v13 or later
  • Improve popup explaining why a password is needed
  • Fix failing to sort servers list after renaming a server
  • Fix duplicates in existing PostgreSQLs list when changing settings
  • Fix incorrectly assuming all "pg_env.sh" files are PostgreSQL-related
  • Fix minor GUI issues
v2.6 28-Feb 2020 Enhancement release
  • Start/stop PostgreSQL without a password
v2.5 12-Feb 2020 Bugfix release
  • Fix start/stop errors on Catalina
  • Improve detection of existing PostgreSQL installations
  • Support dark mode
  • Automate releases using Github & Travis
v2.4.3 20-Jan 2020 Bugfix release
  • 64-bit build for MacOS Catalina
v2.4.2 8-Feb 2016 Bug-fix release
  • Fixed error if user's default shell is fish
  • Improved server status icons
v2.4.1 10-Nov 2015 Bug-fix release
  • Fixed unable to start server because username incorrectly marked as invalid
  • Fixed unable to start server after clicking 'Duplicate Server'
  • Fixed server settings not saved after clicking 'Duplicate Server'
v2.4 30-Aug 2015 Bug-fix release
  • Automatically detect all PostgreSQL processes running on system, not just daemons
  • Fixed leaving 'ghost' process running after stopping Postgresapp.com server
  • Fixed background thread for detecting running servers could stop unintentionally
  • Fixed View Log becoming disabled if change startup setting for running server
v2.3 28-Aug 2015 Enhancement release
  • Improved speed/security: replaced external shell script with native code
  • Invalid server settings now highlighted more clearly
  • Changing startup does not affect running server
  • Startup-at-login supported for all users, not just current
  • Fixed briefly showing server as started even though failed to start
v2.2.1 22-Aug 2015 Bug-fix release
  • Automatically detect running Postgresapp.com server
v2.2 9-Aug 2015 Enhancement release
  • See status of all servers without entering password
v2.1 30-Jul 2015 Enhancement release
  • Automatically detect already-running servers configured elsewhere
  • Start/stop these 'external' servers like any others
  • New 'Duplicate Server' function
v2.0 22-Jul 2015 Major release
  • Control multiple servers from a single window
  • Start servers at computer bootup (previously only at login)
  • Easily debug problems using default server logs
  • See running status of servers without entering a password
  • Starting/stopping still password-protected
  • More code is pure Objective-C, less reliance on shell scripts
v1.4.1 22-Jul 2015 Bug-fix release
  • Fixed error message being shown if username setting is non-blank.
v1.4 03-Jul 2015 Bug-fix release
  • Fixed auto-start on login if upgrading from older version of pref pane
  • Clicking auto-start no longer causes Postgre to startup straightaway
v1.3 30-Jun 2015 Bug-fix release
  • Fixed auto-start PostgreSQL on login (OS X 10.10+)
  • Fixed description of auto-start function in interface
  • Detect errors relating to auto-start and show in interface
v1.2 30-Jun 2015 Bug-fix release
  • Fixed auto-start PostgreSQL on login (OS X 10.9)
v1.1 17-Oct 2014 Bug-fix release
  • Fixed errors caused by spaces or ~ in paths
  • Auto-detect Postgres.app install
  • Fixed incompatibility with latest XCode (ARC now mandatory)
  • Note: requires Mac OS X Lion or newer
v1.0.1 10-Mar 2012 Bug-fix release
  • Fixed hard-coded username in start/stop script
  • Fixed bug where settings were getting cleared when user re-authorized
v1.0 29-Dec 2011 Initial release

Contact

Please email any feedback to info@macca.tech

Licence

This project is covered by the MIT Licence

Links