While in the Project: PostgreSQL Installation, I followed the instructions to install the PostgreSQL in the Mac. But, in the final step of Reset your terminal by executing
source ~./bash_profile, I get:
zsh: no such user or named directory: . (photo).
After seeking for any advice in StackOverflow, I typed:
. ~/.bash_profile. After that, typing
psql worked fine. The problem is, each time I open the terminal, the
psql doesn’t run and I have to retype:
. ~/.bash_profile. Is there any way to avoid that?
PS: Latest macOS versions use the -zsh shell instead of the bash.
Thank you! Have a nice and productive week!
Another great victory and answer found by yourself! Another grain of wisdom in the treasury of your knowledge!
Yes, that’s correct. Starting with macOS Catalina, Apple had changed standard shell to
zsh. So all the steps shall be done to
.zshrc instead of
So is the information on the dataquest page wrong? What should the instructions say for Catalina?
I can’t figure out if my installation worked correctly. When I try the psql -U (my_username) nothing happens. I don’t get errors but nothing seems to change either.
Well, technology ic changing all the time and very fast lately Instructions will be updated eventually.
You have two options for now.
Change the default shell to Bash by running the following command:
chsh -s /bin/bash and everything shall work as per instructions. You can always change the default shell back to Zsh by running this command:
chsh -s /bin/zsh
Or, if you want to use Apple’s new standard shell
zsh, then just replace
~/.bash_profile in the instructions to
~/.zshrc and everything should work again.
Here is nice discussion on the difference between shells.
As for the installation of PostgreSQL, to see if you have it installed, try the following:
- To see the version:
- If nothing happens, try
- If any paths will be located, try to copy-paste complete path to
psql utility, like so:
> $ locate bin/psql
> /usr/lib/postgresql/12.2/bin/psql -V
psql (PostgreSQL) 12.2
If nothing of the above mentioned works, then probably you do not have PostgreSQL installed.
Do not hesitate to comment back if you’ll need further help.
THANK YOU SO MUCH @ranklord!
I can see the version of qpql now. However, my conda install psycopg2 is not working in my cloud instance of Jupyter.
I found someone with a similar error and tried this fix: https://stackoverflow.com/questions/61003308/conda-install-psycopg2-errors
Unfortunately, it did not work again. Is there some kind of workaround for Jupyter that you know of? Also, do you know if it is a Catalina OS issue or if I should be trying to find the answer in a different way? I don’t know what all the stuff the package tried and failed to install does or the info it gives out so I didn’t feel comfortable screenshotting the whole list from the conda install fail but when I run the code from this dataquest page: https://app.dataquest.io/m/129/project%3A-postgresql-installation/4/connecting-to-postgresql-from-psycopg-2
I get the attached screenshot as an error.
Thanks so much again for your help!
I ended up solving my issue another way through a ton of research.
I am assuming part of the issue is being on the Mac Catalina OS but I am not sure.
Add ‘pip’ in your command prompt: https://pip.pypa.io/en/latest/installing/ (Not sure if this step is needed)
Add ‘brew’ in your command prompt: https://brew.sh/
Then, in the command prompt: ‘brew install wget’
Then in the command prompt: ‘brew install postgresql’
Install in your cloud Jupyter instance with: ‘pip install psycopg2’
Whew! A lot of time spent figuring that one out.
(Please let me know if I should not have taken any of these steps or if I should uninstall either of the two programs I listed)
Excellent work! That’s how we get experience