Initialising postgresql problem

Hi @jamesberentsen
have you tried workaround/ suggestions from any of these posts as well?

Hi Rucha

Yes but no use

Hey @jamesberentsen

It seems that you are using mac operating system. I haven’t use mac os before but seeing the error, I can suggest you to look for the article regarding change default port in postgresql for mac operating system. Because the default port of postgresql 5432 is already in use somewhere.

I hope this may help you :slightly_smiling_face:.

Hi I read this article

and ran this line at terminal:
locate postgresql.conf

to get the file path to config file below m, but cannot reach it.

it says to change the configuration file which I cannot access.
I tried navigating , but cannot naviagte into the app which appears like a file here

I can only go into applications and see the postgres app no
Contents/Versions/12/share/postgresql/postgresql.conf.sample

/Applications/Postgres.app/Contents/Versions/12/share/postgresql/postgresql.conf.sample
/Library/PostgreSQL/11/share/postgresql/postgresql.conf.sample
/Volumes/Postgres-2.3.5-12/Postgres.app/Contents/Versions/12/share/postgresql/postgresql.conf.sample

as seen here it is an application not a file so I cannot cd into it or go any further to locate a config file

Hey @jamesberentsen

Can you tell what are the steps you followed to install postgresql in you system?

Hi,
from here

https://app.dataquest.io/m/129/project%3A-postgresql-installation/2/installing-postgresql

I did this–
Download Postgres.app here, move to the
Applications folder, and double click to launch. This applications runs in the background and you’ll need it to be running to connect to it from Python. By default, PostgreSQL will run on port 5432 .

but not the below , because I was not sure how to do it

Add the following line to the end of ~/.bash_profile :

  • export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
  • Reset your terminal by executing source ~./bash_profile

I read this

but was not sure if it was as simple as

Step 2: Type nano .bash_profile – This command will open the .bash_profile document (or create it if it doesn’t already exist) in the easiest to use text editor in Terminal – Nan

since the file opens with nothing inside, but I am not sure if I am doing the correctthing

It seems that you have no experience with the command-line. By the way, try this video here and follow the steps to install PostgreSQL then go with your next slide in the mission.

Update me with your status.

does not work ,
at 2:53 he clicks initialise and it it initialises in video , but as I explained
it does not initialise for me

anyway i found the .bash profile again and added the line
but then this command does not work and i still cannot initialise postgres

source ~./bash_profile

@Bruno Sir, Take a look at this. I think you can help. Thank You :slightly_smiling_face: .

Hey, James.

It seems quite a few things have been tried, with no success. I’m not sure where the problem is, but I’ll start small and we’ll try working from there.

In the screenshot you shared, you should be running source ~/.bash_profile (note where the . is placed). Alternatively, you can just run souce .bash_profile. This is probably unnecessary though, because if you have restarted your computer, this step can be skipped.

Hi Bruno,

thanks the command worked now, but yes it seems that the command
source ~/.bash_profile

is not needed as long as the terminal is restarted.

I still cannot initiialise postgres though

Is this still true? What happens when you run locate postgresql.conf?

Hi Bruno,

yes still true

i run to get

(base) Jamess-MacBook:~ jamesberentsen$ locate postgresql.conf
/Applications/Postgres.app/Contents/Versions/12/share/postgresql/postgresql.conf.sample
/Library/PostgreSQL/11/share/postgresql/postgresql.conf.sample
/Volumes/Postgres-2.3.5-12/Postgres.app/Contents/Versions/12/share/postgresql/postgresql.conf.sample

Instead of locate, can you instead run find / -name *postgresql.conf* 2>/dev/null? I’m not hopeful in this, but it’s worth a try.

Edit: Actually, to minize the feedback loop, please run sudo find / -name *postgresql.conf* instead. You’ll need to authenticate.

Hi Bruno

I ran and there was a lot of output but it seemed to find in two places

find: /Users/jamesberentsen/Library/Caches/com.apple.Safari: Operation not permitted
find: /Users/jamesberentsen/Library/Caches/com.apple.Safari.SafeBrowsing: Operation not permitted
/Applications/Postgres.app/Contents/Versions/12/share/postgresql/postgresql.conf.sample
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory

/Library/PostgreSQL/11/data/postgresql.conf
/Library/PostgreSQL/11/share/postgresql/postgresql.conf.sample
find: /private/var/db/dslocal/nodes: Operation not permitted
/Volumes/Postgres-2.3.5-12/Postgres.app/Contents/Versions/12/share/postgresql/postgresql.conf.sample

I’m just seeing the one result: /Library/PostgreSQL/11/data/postgresql.conf. So there’s your file, please proceed with whatever instructions they gave you on that link and come back you run into other issues.

i proceeded to instructions again and get the same problem which is cannot initialise when click on button get this error message - Port 5432 is already in use

i changed the line in bash_profile file from what it was

to this

i thought perhaps version 11 config file is wrong version though

so i set the export path to this again and still have same problem
**export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/12/share/postgresql/postgresql.conf.sample**

Yeah, probably. I didn’t realize you had two versions installed. My best suggestion at the moment is that you uninstall both versions and make a fresh installation. We can take it from there.

1 Like

https://www.enterprisedb.com/edb-docs/d/postgresql/installation-getting-started/installation-guide-installers/11/PostgreSQL_Installation_Guide.1.12.html
I followed instructions here to uninstall the entire app,

I navigated here
cd /Library/PostgreSQL/11

and ran
open uninstall-postgresql.app
I did get this message though

apparently the data directory has to be removed manually

after the uninstall I listed file contents again and saw this which
I cannot make sense of
. .. 11

The only things left are these two

find: /Users/jamesberentsen/Library/Caches/com.apple.Safari.SafeBrowsing: Operation not permitted
/Applications/Postgres.app/Contents/Versions/12/share/postgresql/postgresql.conf.sample
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
/Volumes/Postgres-2.3.5-12/Postgres.app/Contents/Versions/12/share/postgresql/postgresql.conf.sample
(base) Jamess-MacBook:Library jamesberentsen$ cd /Library/PostgreSQL/11
(base) Jamess-MacBook:11 jamesberentsen$ ls -a
. … data
However I cannot navigate further than the Applications folders so it appears like nothing else to uninstall

since there is not other uninstall app i can find

/Volumes/Postgres-2.3.5-12

Sorry for the delay, I’ve been very busy. I’m also sorry that my replies haven’t been particularly quick.

It’s weird that there are so many files left, but I didn’t really know what to expect. Since you followed the instructions, I’m hoping everything is as it should be.

Run rm -R /Library/PostgreSQL (or sudo rm -R /Library/PostgreSQL if the previous command doesn’t work) to delete that directory and install again. Let’s where that leaves us.