Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Firstly apologies if 'port file isn't the correct terminology', but Postgres is not one of my strong points. I'm trying to find out what this port file should look like as it seems to have gone missing from my system. Please read on for an explanation and my (quite possibly incorrect) trail of thought.

I'm using Postgres with a rails project (through the postgres gem) and it has been working fine until yesterday when it stopped working while I was updating some HTML. I restarted my rails server with the usual

rails s

Only to get:

/Users/pedr/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:1161:in `initialize': could not connect to server: No such file or directory (PG::Error) \n \n
Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

I'm using Lunchy to start and stop postgres and there seems to be no issue there.

However I've used the following Terminal command to check what port Postgres is listening on:

sudo lsof -p 286| awk '$5 == "unix" && $NF ~ /\// { print $NF }'

and it doesn't list anything. So I'm thinking the port has been deleted somehow.

My limited understanding of ports leads me to look in the following location for a port file:

/tmp/.s.PGSQL.5432

There is a file called:

.s.PGSQL.5432.lock

As far as I understand it, this file prevents the editing of the port file which is missing.

I tried using Time machine to find this missing file but it seems that Time Machine doesn't store anything in the /tmp directory.

So how can I recreate this file? What should it look like?

share|improve this question

closed as off topic by Ivo Flipse Jun 22 '12 at 18:51

Questions on Super User are expected to relate to computer software or computer hardware within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.