Anaconda-Navigator - Ubuntu16.04 - anaconda

This is ubuntu16.04. I can open Anaconda-Navigator from the terminal using
anaconda-navigator, but when I click on it, it doesn't open. What am I missing?

To run anaconda-navigator:
$ source ~/anaconda3/bin/activate root
$ anaconda-navigator

Use the following command on your terminal (Ctrl + Alt + T):-
$ conda activate
$ anaconda-navigator

it works :
export PATH=/home/yourUserName/anaconda3/bin:$PATH
after that run anaconda-navigator command. remember anaconda can't in Sudo mode, so don't use sudo at all.

Simply create a new text document called "anaconda-navigator.desktop" in your home directory by the terminal command:
gedit anaconda-navigator.desktop
Then enter the following in your text document:
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Anaconda
Version=2.0
Type=Application
Exec=/path/to/anaconda-navigator
Icon=/path/to/selected/icon
Comment=Open Anaconda Navigator
Terminal=false
Save the file, then move it to your local applications folder:
mv anaconda-navigator.desktop ~/.local/share/applications/
Once this is done, you will be able to search for "Anaconda" on your applications screen, right click, and add to favorites. This way you don't have to go through the terminal every time!
Finished Product

I am using Ubuntu 16.04. When I installed anaconda I was facing the same problem. I tried this and it resolved my problem.
step 1 : $ conda install -c anaconda anaconda-navigator​
step 2 : $ anaconda-navigator
Hope it will help.

add anaconda installation path to .bashrc
export PATH="$PATH:/home/username/anaconda3/bin"
load in terminal
$ source ~/.bashrc
run from terminal
$ anaconda-navigator

Try this:
First go to the anaconda3 binaries directory by running
cd anaconda3/bin
and now use this following command to open the anaconda-navigator
./anaconda-navigator

If all the above methods are not working, you probably install anaconda with root privileges. Remove it with sudo rm -rf /root/anaconda3 and reinstall without sudo.

OPEN TERMINAL
export PATH=/home/yourUserName/anaconda3/bin:$PATH
anaconda-navigator
This will get you going! cheers!

By default anaconda is installed at /root/anaconda3 path, if you want to access it then you should run
su -
cd /root/anaconda3/bin
./jupyter-notebook or ./anaconda-navigator
If you want to change the path, just login as a admin and copy folder to /opt/ or reinstall it.

I am running Anaconda Navigator on Kubuntu 17.04 & getting a successful launch of the navigator window. Not knowing any of your error messages or statement; you could try reinstalling with command:
conda install -c anaconda anaconda-navigator

In my case, I don't need to set up anything further after installing Anaconda on Ubuntu
here is my screenshot for the version info.

Related

Laravel "valet install" not found

I am trying to set up Laravels Valet (Valet is a Laravel development environment for Mac). Everything works until it comes to the command "valet install". This command must be executed in terminal. But I got the error "command not found". Any ideas, why? Do I have to update my PATH or something else?
I switched to OS X a few days ago. Before that, I was a windows user. So I am a total newbie.
Yes, you need to make sure that ~/.composer/vendor/bin directory is in your system's PATH, you can check this by running:
echo $PATH
If you can't see it there, then you need to add this to your ~/.bash_profile:
export PATH=$PATH:~/.composer/vendor/bin
If you're getting the error message "valet: command not found", it's likely that PHP's Composer is not in your PATH variable, for instance:
$ valet install
-bash: valet: command not found
You can confirm if Laravel Valet was successfully installed by running the following command:
ls -al ~/.composer/vendor/bin/valet
If successfull, you'll see the symlink for Valet in Composer's bin directory pointing to Laravel in the vendor directory:
~/.composer/vendor/bin/valet# -> ../laravel/valet/valet
To test whether your PATH is missing Composer, try running the Valet command directly:
~/.composer/vendor/bin/valet --version
If you're shown the Laravel version number, (e.g. Laravel Valet 2.0.4), this indicates Valet is installed but you need to update your PATH variable to include Composer for the valet command to work globally.
In your Terminal, execute the following command which will append Composer to your shell's PATH:
export PATH=$PATH:~/.composer/vendor/bin
For the changes to take effect, you'll need to exit and re-open your Terminal window or tab.
Alternatively, you can simply source your shell's profile, which doesn't require quitting your active session:
source ~/.bash_profile
If you have a different shell environment or you're using a shell other than Bash, you will need to source its configuration profile instead (e.g. .bashrc, .zshrc, config.fish).
I'm using oh-my-zsh so:
echo "export PATH=$PATH:$HOME/.config/composer/vendor/bin" >> ~/.zshrc
source ~/.zshrc
You may replace .zshrc with .bashrc
you just have to use:
export PATH="$PATH:$HOME/.composer/vendor/bin"
then
valet install
ready :)
Make sure that ~/.composer/vendor/bin directory is in your system's PATH, you can check this by running:
echo $PATH
If not there, open your ~/.bash_profile and add this code:
export PATH=$PATH:~/.composer/vendor/bin
Then run:
composer global require laravel/valet --dev
Once it is done, run:
valet install
If valet install doesn’t work, but ~/.composer/vendor/bin/valet --version does work, try installing it via
~/.composer/vendor/bin/valet install
To See if that worked, check
valet --version
If you're using zsh, you cannot use ~ as path to home dir, use $HOME instead.
In .zshrc file, instead of adding this:
export PATH=$PATH:~/.composer/vendor/bin
Add this and the path will resolve:
export PATH=$PATH:$HOME/.composer/vendor/bin
If you have a fresh installation, you may not have the PATH variable contains your home path. So, adding the $HOME variable would require like the following:
export PATH="$PATH:$HOME/.composer/vendor/bin
This command might solve your problem
test -d ~/.composer && bash ~/.composer/vendor/bin/valet install || bash ~/.config/composer/vendor/bin/valet install
In Ubuntu 18.04 do this:
echo "export PATH=$PATH:$HOME/.config/composer/vendor/bin" >> ~/.bashrc
source ~/.bashrc
with new composer installation, you need to add a new path which is
export PATH=$PATH:~/.config/composer/vendor/bin
Then you need to
chown YOUR_USERNAME ~/.config
for accessing composer packages without sudo command.
I have installed Composer version 2 and found that composer default path is ~/.config/composer/ and similarly valet is also installed on /.config/composer/vendor/bin/valet.
So to solve this issues I added the composer path to ~/.bashrc file as:
export PATH=$PATH:~/.config/composer/vendor/bin
Add ~/.composer/vendor/bin directory to your PATH variable.
For me worked
write in console
cd ~/.composer/vendor/bin
pwd
copy pwd command result
export PATH=$PATH: (pwd command result)
valet install
I think I explained well
I found a fix on this website, and it fixed my issue.
test -d ~/.composer && bash ~/.composer/vendor/bin/valet install || bash ~/.config/composer/vendor/bin/valet install
https://hidayatabisena.medium.com/solving-issues-command-not-found-laravel-valet-install-on-macos-mojave-2a7629759a9f
In my case I've to update /etc/profile file
added
export PATH=$PATH:~/.composer/vendor/bin
in
/etc/profile
then
source ~/etc/profile
In my case I found the valet location by manual search
Then add the the valet file path to PATH variable
echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc
Then I ran the install command and it worked
valet install
Php may be not installed
Use your prefered version with:
brew install php
// or
brew install php#8.0
// or
brew install php#7.4
This solved my issue.

Anaconda launcher won't open

I downloaded anaconda but when I click on the launcher application it doesn't open. I have tried to update it in terminal but it says command not found. How can I fix this?
In addition to fixing the path issues, as suggested by Thomas.
(Assuming you didn't press yes wen the installer asked if you wanted to prepend the Anaconda install location to your PATH)
It might just help to install the launcher:
>> conda install launcher
Anaconda Navigator stopped working after running TensorFlow script.
I reinstalled a new version of Anaconda. That did not fix the problem.
I followed a advice from:
https://github.com/ContinuumIO/anaconda-issues/issues/910
that did not fix the problem either.
Finally I tried this and it worked:
sudo rm -rf ~/.continuum/
Somehow ~/.continuum/ was owned by root.
In Windows, I used spyder directly from here:
C:\Program Files\Anaconda3\Scripts\spyder.exe
This is good to start coding.
Maybe the permission question, using the iterm run anaconda-navigator, you will get the error message.
If it's the permission question, just rename the permission file.
You should use this command:
python -m pip install jupyter notebook
then
just type:
jupyter notebook
it will work accurately.
I faced the same problem on my mac. Deleted the config.yaml file inside the binstar folder
/Users/<user_name>/Library/Application Support/binstar by using the command
rm -rf config.yaml
and it worked. I could open anaconda navigator.

firebase-tools "-bash: firebase: command not found"

Excited that Firebase's hosting is now out of beta. Trying to get going with with the firebase-tools package and I've successfully installed it:
npm install -g firebase-tools
Trying to run any tool fails with
-bash: firebase: command not found
I've tried putting the following command in my .bash_profile without any luck
export PATH=/usr/local/share/npm/bin:$PATH
Any ideas? Pretty new to the command line in general.
Thanks!
Run code below with terminal,
alias firebase="`npm config get prefix`/bin/firebase"
Installing firebase-tools globally did the trick for me :
npm install -g firebase-tools
You should add the npm bin folder to your bash PATH variable. To do that, run:
npm get prefix
And it should output something like /home/your-username/npm-global or /home/your-username/npm-packages.
Then in your ~/.bashrc or ~/.bash_profile (if you're in a Mac) file, add:
export PATH="/home/your-username/npm-global/bin:$PATH" # Add npm bin PATH
Note the "/bin" after the npm get prefix result.
#mklement0 That answer looks good, but I'm worried it will be intimidating to someone who is so new to the command line. So I'm going to cherry-pick the most relevant piece of it.
#cienki Run this command to see what you should be putting in that PATH prefix in your .bash_profile file:
npm get prefix
by chance if you are using macOS with m1 chip
arch -x86_64 npm i -g firebase-tools
assuming that you haven't set the PATH
export PATH="`npm config get prefix`/bin:$PATH"
That's all and enjoy
On macOS: Use
curl -sL firebase.tools | upgrade=true bash
It worked for me
firebase -V
Using Windows 10, Bash
This worked for me:
npm get prefix // to find Path which for me it was C:\Users\User\AppData\Roaming\npm
search "Environment Variables" which located in "System Properties".
Under "System Variables", find the PATH variable, select it, and click "Edit". Click "New" and add the path found with the "npm get prefix" command earlier (which was for me C:\Users\User\AppData\Roaming\npm)
Then click "Ok"
Restart Bash
firebase --version //to check firebase version
Bruno's answer did the trick, I only needed to add a dot at npm-global in Ubuntu in .bashrc:
export PATH="/home/your-username/.npm-global/bin:$PATH" # Add npm bin PATH
Below command works for me on terminal
curl -sL firebase.tools | upgrade=true bash
This command install firebase tool for me
After installing:
$ npm install -g firebase-tools
$ firebase init
-bash: firebase: command not found
"If you are getting the above output then follow the below steps:"
For Windows Users:
type this cmd :
$ npm get prefix
C:\Users\Jeet\AppData\Roaming\npm [this is the location]
Now you have to set in enviorenment variable -> (windows+r) -> sysdm.cpl -> Advanced(tab) -> Environment Variables
-> under the System Variables -> click on path -> edit -> C:\Users\Jeet\AppData\Roaming\npm [paste] the above location -> apply - ok - ok.
Restart your bash terminal
Thanks!!!
For Mac OS Sierra:
$ sudo npm install -g firebase-tools
To stop other Node process use $ ps aux | grep node
If needed to upgrade or install emulator - $ npm install -g #google-cloud/functions-emulator
Ready to go $ firebase --version
For anyone using MacOS Catalina 10.15.2 getting the bash PATH variable fixed the issue for me.
Run:
npm get prefix
Then run:
export PATH=/Users/userid/.npm-global/bin:$PATH
Note: I recently upgraded from my old High Sierra MacBook Pro, and was confused as well.
For anyone using nvm the error could arise because you are on a different nvm version than you were on when you first installed firebase tools globally. That's what it was for me. When I restarted webstorm nvm switched to a different version.
Run nvm list to check the version you are on and run nvm use x.x.x to switch to the right version where you installed firebase tools originally.
This worked for me on Mac (same thing the others have been posting above, just for Mac):
go to your home folder in Finder (named after your user name, in my case "macbook")
press cmd+shift+dot (will reveal hidden files)
go the .npm-global/bin folder and copy its path (Finder menu -> View -> Show Path Bar, right click on the bin folder in the path bar -> "Copy 'bin' as Pathname")
open Terminal (by default the home folder) and go nano ~/.bash_profile
at the top of the file add export PATH="<cmd+v>:$PATH" (will look similar to this: export PATH="/Users/macbook/.npm-global/bin:$PATH")
save .bash_profile changes and restart Terminal, firebase command should work now
if you installing firebase-tools using
yarn global add firebase-tools
i got same error then i got answer and execute this
export PATH="$(yarn global bin):$PATH"
and then i can do firebase login pretty well
I am on Linux and installing the package with admin privileges resolved the problem:
sudo npm i -g firebase-tools
Simply reinstall node.js. This worked for me and fire command was recognized.
You forgot sudo type this
sudo npm install -g firebase-tools
problem solved.
I know most answers work for all generic 'command not found' errors. Basically by manually setting PATH variable but there's an easier way for this specific problem relating 'firebase command not found':
Try this cURL command and it will fix this issue for good and will minimise any user errors.
Install the Firebase CLI using the automatic install script
Run the following cURL command (Mac or Windows):
curl -sL https://firebase.tools | bash
Source: https://firebase.google.com/docs/cli#install-cli-windows, https://firebase.google.com/docs/cli#install-cli-mac-linux
This is for updated mac mac Os Catalina(10.15.1+) & on zsh.
Go to Terminal (vim .zprofile)
add this export PATH="/Users/Your Username/.npm-global/bin:$PATH"
Works for me!
Faced the same issue, am a newbie backend guy.
Used npm install firebase-tools
It doesn't install and you can't run.
I tried looking at the forums and here's what worked for me:
sudo npm install -g firebase-tools.
Then it asks for Permissions when you firebase login.
Am using Ubuntu.
After trying pretty much everything, only one worked for me (I'm on MacOs Catalina):
Try the following in your terminal:
curl -sL https://firebase.tools | bash
This will check the OS of your machine and then install everything else automatically and properly.
The command is from the official Firebase Documentation.
https://stackoverflow.com/a/60474459/1245341
After installing
$ npm install -g firebase-tools
Note the directory where it istalled What I did was locate the directory where firebase was installed. In my case C:\usr\local then I copied the three firebase files. I also went into the node_modules folder and copied the firebase tools folder. Then I went to my app directory in file manager and pasted the firebase files, then created a new node_modules folder and pasted the firebase-tools folder.
Now go to your cmd and run
$ firebase init
It should work
I tried a lot of things from here and from other forums, but what ended up working for me (and this is more of a work-around) was to download the binary and then open it and it set up all the firebase stuff for me.
However, I found that if I moved it after opening it once, it did not work. So first move it to wherever you want to leave it and then run the .exe.
This allowed me to skip configuring the PATH variable which was nice.
I'm on a Windows 10 Pro Education. Hope this helps someone who has a similar struggle.
Adding to Durul Dalkanat's answer,
Assuming you have executed npm install firebase-tools -g
Firstly get the output of the command of npm get prefix.
Open .bashrc file which is in the home directory and add alias <output of npm get prefix>/bin/firebase at the end of the file.
Run source .bashrc in the home directory.
Enjoy!
The alias of firebase will be the actual firebase path in the main system and this solution should work flawlessly.
if you're windows 8 user, one possible solution is to put the PATH in environment variables manualy...
On the Windows desktop, right-click My Computer.
In the pop-up menu, click Properties.
In the System Properties window, click the Advanced tab, and then click Environment Variables.
In the System Variables window, highlight Path, and click Edit.
In the Edit System Variables window, insert the cursor at the end of the Variable value field.
If the last character is not a semi-colon (;), add one.
After the final semi-colon, type the full path to the file you want to find.
For me it was: C:\Users\ 'username' \AppData\Roaming\npm
To get your path put this string in you command line:
$ npm get prefix
Click OK in each open window
I tried all the answers above, other SO answers, and GitHub answers but nothing worked. The only thing that worked for me was to save whatever was inside my index.js file temporarily somewhere else, delete the entire cloud functions folder, then reinstall and start everything from the very beginning.
After many hours trying everything the only thing what helped (on windows) was downloading and installing node again.
I found a solution.
npm i express firebase-tools
If you are admin on your PC, installing firebase and firebase-tools with -g flag should resolve the issue (the path will added to the global PATH variable) but if you are an admin, you may have to add that path yourself.
Seeking help from one of the top answer, issue this command will return the path where firebase is installed
npm config get prefix /bin/firebase
In my case the following is returned.
C:\Users\*user_name*\AppData\Roaming\npm
Copy that path (from first line) and visit this page on how to update path variable (Window + x then visit systems > Advance Settings). Here add a new entry in path and past that path there. Firebase command should work from command prompt every time without the use of alias required.

Mongod: Command Not Found (OS X)

I am trying to test MongoDB and I have it all downloaded and moved into the root folder. I can navigate to the folder that holds the mongod, but when I try to run it by typing "mongod" into my terminal, I get a message that says:
"mongod: command not found"
Both answers above are correct.
You can either specify the path in one of the following files: .profile, .bashrc, or .bash_profile
export PATH="$PATH:/usr/local/mongodb/bin"
then call the daemon or the shell directly
mongod
mongo
Or for the commands not in the $PATH, use ./mongo or ./mongod from the directory containing these files. This solution can be verbose has you will have to eventually append the whole path when calling these commands from another directory.
/usr/local/mongodb/bin/mongod
or
/usr/local/mongodb/bin$ ./mongod
"Mongod" isn't a stand-alone command. You need to run the command like this:
./mongodb/bin/mongod
I used this webpage to help me answer this question.
This worked for me:
brew tap mongodb/brew
brew install mongodb-community#4.2
mongod
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
For example, install 64bit MongoDB 2.6.12 on macOS Catalina.
(for newest versions you may go to https://www.mongodb.com/download-center/community for your platform).
Download, extract and move:
wget http://downloads.mongodb.org/osx/mongodb-osx-x86_64-2.6.12.tgz
tar xzf mongodb-osx-x86_64-2.6.12.tgz
mv mongodb-osx-x86_64-2.6.12/ /usr/local/mongodb/
Add to file ~/.zshrc this:
export PATH="$PATH:/usr/local/mongodb/bin"
PS: .bash_profile or .profile not worked in my case
Reload terminal (or close, open it):
source ~/.zshrc
Make directory for data and set rights:
mkdir -p ~/data/db
chown -R mongodb.mongodb ~/data/db
Run MongoDB:
mongod --dbpath ~/data/db
You need to add the name of the folder that contains the command mongod into your PATH so your shell knows where to find it.
So, if mongod is in /usr/bin/freddyfrog, you would edit ~/.profile and find the line that says PATH= and edit it to look like this:
export PATH=${PATH}:/usr/bin/freddyfrog
Then login again to make it take effect.
I received the same error message because I used the wrong command to run mongod (meant for M1s) for my 2019 MacBook with an Intel processor. You can skip past Homebrew updates and MongoDB installation but here's how I resolved my issue:
Download Xcode Command Line tools.
xcode-select --install
Allow Homebrew to add and access MongoDB:
brew tap mongodb/brew
Update Homebrew:
brew update
Install MongoDB Community Edition (#6.0 is the latest version at the time of this post):
brew install mongodb-community#6.0
macOS with Intel processors:
mongod --config /usr/local/etc/mongod.conf --fork
macOS with Apple M1 processors:
mongod --config /opt/homebrew/etc/mongod.conf --fork
Then open the shell:
mongosh
Or just run mongod.
Official documentation on installation here.
3 steps:
Step 1:
export PATH="$PATH:/usr/local/mongodb/bin"
OR
export PATH="$PATH:/usr/local/opt/mongodb#3.2/bin"
(replace version number with your local version)
The first step will allow you to run the command, but will get you another error: "/data/db does not exit" so you have to
Step 2 :
sudo mkdir -p /data/db
Now /data/db is read only, but it has to be writable also so
Step 3 :
sudo chown -R USERNAME /data/db
I was trying to install a previous version (3.6) using latest documentation (4.2 is already released). So, they now call it mongodb-community#3.6.
In order to update PATH for such setup, the statement should be
export PATH="$PATH:/usr/local/opt/mongodb-community#3.6/bin";
I got hint from #retroGiant 's answer
run this command, it works:
brew services start mongodb-community#4.0
I have installed mongodb-community#3.2, was facing the same issue. I followed below steps.
open bash profile in any editor (you can also try - vi ~/.bash_profile)
write this export PATH="$PATH:/usr/local/opt/mongodb-community#3.2/bin" & save.
do this . source ~/.bash_profile
In root directory
sudo mkdir data
cd data
mkdir db
then
sudo chown -R yourUsername /data/
copy path of your mongodb/bin downloaded folder (I suggest you put it in home folder not root dir)
in terminal
export PATH="paste the link here :$PATH"
now it should work but if not
In case you are using different Unix shell and
trying to execute mongod within visual studio code( for example ),
make sure to read the documentation to link PATH.
For example, if you are using zsh create .zprofile in your home directory.
touch .zprofile
copy your previously made PATH into .zprofile
Now everything should work as expected.
I was looking for the same and later I have found that now it's very straight forward to install the new MongoDB Community Edition like below:
Installing MongoDB 6.0 Community Edition
brew tap mongodb/brew
Note: If you haven't yet install brew then follow this link: https://brew.sh/#install
Update Homebrew
brew update
Install MongoDB
brew install mongodb-community#6.0
The installation includes the following binaries:
The mongod server
The mongos sharded cluster query router
The MongoDB Shell, mongosh
Run MongoDB Community Edition
To run MongoDB (i.e. the mongod process) as a macOS service, run:
brew services start mongodb-community#6.0
To stop a mongod running as a macOS service, use the following command as needed:
brew services stop mongodb-community#6.0
MongoDB 5.0 issue resolved - SEP/2022
do following steps
step 1: open a .zshrc file if it does not exist it will create by itself by following the command. For opening or creating a .zshrc file below command is the same.
vim .zshrc
step 2: insert value in it by pressing 'i'
step 3: insert the below command there or paste it there.
export PATH="$PATH:/usr/local/opt/mongodb-community#5.0/bin"
step 4: to exit click on esc key and the write :wq
step 5: Close the terminal and reopen it and type the below command
mongo
Output
MongoDB shell version v5.0.11
connecting to: mongodb://127.0.0.1:279021/?
compressors=disabled&gssapiServiceName=mongodb
Successfully integrated mongo 🎉 🎉 🎉
happy coding !!
If you use brew then check the path:
brew list
brew list mongodb-community#...
then add it to .zshrc
zsh: command not found: mongo
after that use mongosh instead of mongo
This answer is a little bit unrelated, but if you using vscode & would like to interact with mongoDB using command line, have a read.
I was looking to use mongod command as well (as i love to use command to interact with mongoDB), but after several attempts of install i completely give up. Until i found this, the mongoDB vscode extension.
The extension is loading the data pretty fast just like mongod command compare to mongo compass. It allow you to perform CRUD & aggregation in the mongoDB playground, and most importantly you able to retrieve the command on next execution by storing your command in a file with .mongodb extension.
*Update: After using it several weeks, everything is nice, just need to make sure you connecting to the right mongoDB connection (if you establish few different connection)

How to put psql on the path when using Postgres.app on OS X?

I've installed Postgres93 on my Mac. I can open the application, and "Open psql" through the app which opens up a command line interface with psql.
However, when I type $ which psql nothing is returned. The installation path is /Applications/Postgres93.app. How do I make $ which psql show the correct result?
Mac OS X - Mavericks
PostgreSQL package, I'm not as sure about. I went here and downloaded it - http://postgresapp.com/
I just had postgres installed and was not able to run the psql command until I ran the following command in my terminal:
export PATH="/Applications/Postgres.app/Contents/Versions/9.5/bin:$PATH"
Now the terminal knows where to find postgres when I use the psql command.
Remember to replace the version number '9.5' with your current version.
I had the same problem with nothing showing for the which psql command till I run the command below to resolve it. The command provided below is just a little tweak of what has already been provided by others here. The only difference is, instead of providing a specific postgres version number in the command, you can simply tell postgres to use the latest postgres version by simply running the following command:
export
PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH"
And now my terminal was able to find the path to postgres when I run which psql.
Hope this helps.
On macOS Mojave these instructions work well:
If your Postgres has not been installed yet, I suggest you use the great "brew" package manager from here https://brew.sh/ :
$ brew cask install postgres
or you can install it usual way from the website
Put this to the bottom of your ~/.bash_profile file:
export PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:${PATH}"
Restart your terminal or restart your ~/.bash_profile directly with the command:
$ . ~/.bash_profile
Verify your installation:
$ psql --version
** Edited: to include a permanent fix, not just during your current session. **
I had this same problem, and also found a clear answer lacking in the docs.
To fix:
Download the new app, and follow the instructions to move it to the Applications folder
Add the new bundle to your path by typing the following in your Terminal (version number specific - mine is 9.4):
PATH="/Applications/Postgres.app/Contents/Versions/9.4/bin:$PATH"
To fix the issue on a permanent basis, run the same line but with export in front:
export PATH="/Applications/Postgres.app/Contents/Versions/9.4/bin:$PATH"
It appears that you installed Heroku's Postgres.app, which is a tool intended for throw-away testing and development. Add the contents of the bundle to your PATH by following the instructions in the Postgres.app documentation - see "command line tools".
On macos mojave i've added the following line on my ~/.profile :
export PATH=$PATH:/Library/PostgreSQL/10/bin
the psql command line client lies into this folder. i've used the enterprisedb installer.
I just experienced the same problem, and solved it by adding export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin to .bash_profile. Note that this line is version-specific, so be sure to check this line against your current version of Postgres.app.
Using Mac OS Monterey, the latest Homebrew (3.4.0) and postgres#13.
I was able to add psql to the path by using -
export PATH="/opt/homebrew/Cellar/postgresql#13/13.6/bin:$PATH"
Replace #13 and 13.6 with your version.
The latest homebrew install location seems to be /opt/homebrew/*
I'm using catalina 10.15.3 and I had the same issue after installing psql using homebrew. Then I noticed, homebrew mentioned
==> libpq
libpq is keg-only, which means it was not symlinked into /usr/local,
because conflicts with postgres formula.
If you need to have libpq first in your PATH run:
echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.bash_profile
So, I ran 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.bash_profile and psql was added to my path
In Mac, there is a SQL Shell application already under /Applications/PostgresSQL
try that
Also, you can run /Library/PostgreSQL/11/scripts/runpsql.sh
In my case, I installed Postgres12 and had the same issue. I had to look out for the location of my bin folder. It happened to be in /Applications/2ndQuadrant/PostgreSQL/12/bin. So I had to run export PATH="/Applications/2ndQuadrant/PostgreSQL/12/bin:$PATH" in my terminal and restart the terminal. That solved it.

Resources