Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a straightforward way to connect to Postgres.app with dbext (in Vim)?

When I try to connect to my Postgres.app db using dbext, I get the following error:

dbext:PostgreSQL requires a '$HOME/.pgpass' file in order to authenticate.  This file is 
missing.  The binary 'psql' does not accept commandline passwords.

Other programs connect just fine by using a "local" connection. (Postgres.app runs with my userid.)

In vim :!which psql correctly prints /opt/local/bin/psql (which I have symlinked to the one in the Postgres.app bin directory). And Postgres.app is set up to use "local" authentication and there's no clear sense of where a pg_hba.conf file would go (there is no etc directory in the app bundle). Moreover, Postgres.app doesn't have anything in its documentation about changing access configuration.

I've tried using dbext's :DBPromptForBufferParameters directly, as well as @tpope's vim-rails plugin (which returns without comment from dbext setup via :Rdbext.

So what do I do to get dbext to connect using a "local" connection?

Note - I spent a LOT of time trying to figure this out without trying the obvious, thus the post even when I already have the answer. I'm also curious to see if anyone else has a different approach.

like image 584
Dav Clark Avatar asked Jan 19 '26 09:01

Dav Clark


1 Answers

It turns out you can just make an empty ~/.pgpass file (restricting read-write permissions to your userid only to avoid warnings). This was counterintuitive for me (since there is in fact no password), but I suppose in retrospect it's obvious I should have tried it.

I'll point this out on the dbext issue tracker.

like image 133
Dav Clark Avatar answered Jan 22 '26 06:01

Dav Clark



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!