How to conveniently restart pgAdmin 4?
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 }') &amp;&amp; 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.