My problem was originally that I am unable to use PostgreSQL because I do not know the password - nor have I ever made one. I was trying to reset or recover the password and followed various advice in trying to do this.
At first I tried to edit the pg_hba.conf file, which I located by using the following command:
sudo vim /etc/postgresql/9.3/main/pg_hba.conf
But this just took me to a blank screen that I could do nothing with except close the window.
I was told to try:
sudo nano /etc/postgresql/9.3/main/pg_hba.conf
...which was better because this included key commands at the bottom of the page, but the file was blank, and so couldn't be edited.
After going back into this, and I suppose causing some error, if I go back into it now, I get this:
E325: ATTENTION
Found a swap file by the name "/var/tmp/pg_hba.conf.swp"
owned by: root dated: Tue Oct 17 15:57:30 2017
file name: /etc/postgresql/9.3/main/pg_hba.conf
modified: YES
user name: root host name: Roberts-MacBook-Pro.local
process ID: 2668
While opening file "/etc/postgresql/9.3/main/pg_hba.conf"
(1) Another program may be editing the same file. If this is the case,
be careful not to end up with two different instances of the same
file when making changes. Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r
/etc/postgresql/9.3/main/pg_hba.conf"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file
"/var/tmp/pg_hba.conf.swp"
to avoid this message.
Swap file "/var/tmp/pg_hba.conf.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit,
(A)bort:
I tried deleting the .swp file by typing D, but this didn't seem to do anything.
I'm really confused about all of this and I don't really know how I can learn more to understand what I'm doing. When I go to the PostgreSQL website I read what the pp_hba.conf file should look like, but the only way I can access this file, it has been completely empty.
I don't know where to go from here so I would really appreciate advice from anyone who can point me in the right direction, thanks.