1

I have pgAdmin on my dock, and can open it when the process isn't already running (ie. after a restart, or if I manually kill it).

If I open pgAdmin, close the window, then later try to open it from the dock, the app doesn't respond.

This dock behavior is similar to MySQL Workbench, except that MySQL has the "running process indicator" (little circle on dock below the icon), while pgAdmin does not, which means that right clicking on the pgAdmin icon does not give me the option to quit.

I tried using a bash function, which for MySQL would look like this:

killall MySQLWorkbench && open /Applications/MySQLWorkbench.app

This works fine for MySQL Workbench, but isn't necessary since I can restart it from the dock.

For some reason, with pgAdmin, the process doesn't get killed, so the app never opens:

>> killall pgAdmin\ 4
No matching processes were found

The app is clearly visible in Activity Monitor with the name pgAdmin 4

The only solution I have currently is to manually kill the process from Activity Monitor, but this is quite redundant.

How can I conveniently restart pgAdmin 4?

I would prefer a solution that allows me to restart it from the dock, but a bash script would also suffice.

Software:

  • pgAdmin 4 : 4.17
  • macOS Catalina : 10.15
  • @klanomath Thanks, but I didn't quite get that last part. What did you mean "task makes no sense" ? – Elrond Supports Monica Feb 6 at 1:18
  • @klanomath don't be sorry, they were helpful! thanks – Elrond Supports Monica Feb 6 at 15:59
  • @klanomath Also, I needed the bash script because if the browser process ends while pgAdmin is running, then any attempts to go http://127.0.0.1:63145/browser/ will result in an authorization error, which I think is a bug/design flaw. – Elrond Supports Monica Feb 6 at 16:04
  • 1
    not to forget: I was tired (it was 3am in the morning) and I couldn't really believe that|understand why pgAdmin not only shut down itself but also the PostgreSQL server. – klanomath Feb 6 at 16:04
1

pgAdmin 4 (/Applications/PostgreSQL 12/pgAdmin 4.app) is a simple launcher for /Library/PostgreSQL/12/pgAdmin 4.app which itself is some kind of a service wrapper.

Besides launching a small web server, it also starts the menulet "pgAdmin 4" (the black elephant) and probably does some other things too.

The recommended way to restart pgAdmin 4 is to quit the menulet pgAdmin 4 ("Shut down server") and launch pgAdmin 4 again from the Dock.

If you insist to use the shell or a shell script, the best you can get is probably something like:

kill -s TERM $(ps aux | grep '[p]gAdmin4' | awk '{print $2 }') && open -a "pgAdmin 4"

You have to clean up (i.e. close) the now defunct browser window of the previous session manually.


If you just want to re-visit the pgAdmin PostgreSQL management page (after accidentally exiting the browser or closing the browser window/tab or if you want to use another browser) you don't have to quit and relaunch pgAdmin.

The formerly displayed url (e.g. http://127.0.0.1:49211/browser/) won't work anymore but a file in your home folder contains a working url with an auth key:

cat ~/.pgA*.addr
http://127.0.0.1:49211/?key=c1b4f6c8-fa99-4af2-9ebd-06d71586c266 #example

Enter this url in your browser and you can visit the page without authorization error 😉.

In the shell this is: open $(cat .pgA*.addr). This will launch your standard web browser and open the management page.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .