skip to Main Content

Used Homebrew to install Postgres@16 on Mac OS X Sonoma 14.3.1.

brew install postgresql@16

When I come to connect:

psql -U postgres -h localhost

psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL:  auth_permission_dialog.dialog_executable_path is not a file

2

Answers


  1. Chosen as BEST ANSWER

    After a reboot the error changed to:

    psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL:  role "postgres" does not exist
    

    I added a user:

    createuser -s postgres
    

    Restarted the service:

    brew services restart postgresql@16 
    

    All good now:

    psql -U postgres -h localhost
    psql (16.2, server 16.1 (Homebrew))
    Type "help" for help.
    
    postgres=# 
    

  2. after the installation with homebrew, there is one user in Postgres (named like your login-Name e.g."YourUsername").
    And there is one database with name "postgres".

    Lokk at the result of

    psql --help
    

    you will see what the problem is?

    Usage:
       psql [OPTION]... [DBNAME [USERNAME]]
    
    General options:
    ...
    
    -U, --username=USERNAME  database user name (default: "YourUsername")
    -d, --dbname=DBNAME      database name to connect to (default: "YourUsername")
    
    ...
    

    For your first access you should simply call.

    psql postgres    or    psql -d postgres
    

    The second parameter is just the database-name and therefore the result is something like this.

    postgres=#
    

    Now you can do, whatever you want. Feel free to create a database with name "YourUsername".

    create database YourUsername;
    

    with the result:

    CREATE DATABASE
    postgres=#
    

    Leave the cli and call psql without any Parameter.

    postgres=# q
    
    -->
    psql
    
    psql (14.11 (Homebrew))
    Type "help" for help.
    
    YourUsername=# 
    

    What happend? Postgres found the default user and the default database. You can see you are working on the database YourUsername, since the result shows
    YourUsername=#.

    Its quite easy.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search