Why is -bash: PATH: command not found displayed when I open my terminal window? - osx-lion

I installed EPD Free 7.3.2 and it was running fine until I wanted to modify PATH to point to where my Python scripts are. I gave up on that and reverted back to my original .bash_profile file.
# Setting PATH for EPD_free-7.3-2
# The orginal version is saved in .bash_profile.pysave
PATH = "/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
export PATH
When launching terminal, I get this:
Last login: Thu Jan 3 08:50:20 on ttys000
-bash: PATH: command not found
However, I am able to run iPython and all the libs that come with EPD w/o problems. Anybody knows what the problem is with "PATH: command not found"?

The spaces around the = are a problem. Use this assignment:
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"

You need to remove the spaces around =:
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
Otherwise you're trying to run the (non-existent) command PATH with = and "/Library..." as its arguments.

Related

WSL vscode command returning error "not found"

I have this message whenenver i try to type code .
Can someone help me please ?
Thanks in advance
Fixed it
Open VS Code on Windows
Open Extensions and then search on WSL
It should say the extension needs to be reloaded - go ahead and reload it
Open WSL and type code
This should force another upgrade of code and this time it should launch.
I just now had the same issue on WSL2 Kali. I tried everything given here: https://github.com/microsoft/vscode-remote-release/issues/2962.
My problem was VS Code was not on Kali's path. Here's how I fixed it :)
echo $PATH
# Confirm PATH is missing this:
/mnt/c/Users/wcd/AppData/Local/Programs/Microsoft VS Code/bin/
# Confirm VS Code's location then export:
export PATH=$PATH:"/mnt/c/Users/wcd/AppData/Local/Programs/Microsoft VS Code/bin/"
# It's temporarily added to path...
echo $PATH
# This should now trigger VS Code Server install,
# then open ~/ in VS Code.
code .
# If above works, make it permanent:
echo 'export PATH=$PATH:"/mnt/c/Users/wcd/AppData/Local/Programs/Microsoft VS Code/bin/"' >> ~/.bashrc
# Restart shell + test
exec "$SHELL"
code .
I solved this problem by opening windows powershell in admin mode and typing the following command:
wsl --update
Then I typed this command to force restart the WSL and all done
wsl --shutdown
I have same issue when I trying export my old wsl and move whole project to nvme ssd using new distro.
I able to run the code . on root , but when i switch to my name then it doesn't work, I guess is WSL PATH problem.
I not really familiar to the linux, the below image may easier for you to understand what i am saying.
When i use echo $PATH on wsl to compare root and my account, and i notice that VS code directory only found on root instead of my account.
So i use export PATH=$PATH:"/mnt/c/Users/ricso/AppData/Local/Programs/Microsoft VS Code/bin" to add the VS Code path to my account* and code . is working once i export this.
But the code . will not be able to run again if you restart the wsl, so we need to put in to bashrc.
But when i try to update my account's* PATH using
echo "PATH=$PATH:/mnt/c/Users/ricso/AppData/Local/Programs/Microsoft\ VS\ Code/bin" >> ~/.bashrc and restart the wsl to login my account, i notice an error msg popup when run the code .
cannot create /tmp/remote-wsl-loc.txt: Permission denied
And i found this.
https://github.com/microsoft/vscode-remote-release/issues/5389
Seem they only giving the workaround for now and hopefully can fix it soon.
*disclaimer above: this code need to run under your account instead of root
**For editing bashrc, instead of using echo and >> write to the file, you also can use code ~/.bashrc to update/edit, when you have the vscode access on wsl.
This also happens if you disable the Windows PATH on WSL. I had my VS Code working fine, then when I disable the windows PATH (by editing/creating the /etc/wsl.conf file and inserting the [interop] appendWindowsPath = false parameter) the code command stopped working.
The ek1n8 solution solves my problem, addind the export manually to the WSL Path:
export PATH=$PATH:"/mnt/c/Users/%USERNAME%/AppData/Local/Programs/Microsoft VS Code/bin"
For me adding the binary to Path was enough:
export PATH=$PATH:"/mnt/c/Users/%USERNAME%/AppData/Local/Programs/Microsoft VS Code/bin"
For me it was wsl using the wrong container:
wsl --list -v
NAME STATE VERSION
* docker-desktop-data Stopped 2
Ubuntu Running 2
I did wsl -s ubuntu
wsl --list -v
NAME STATE VERSION
* Ubuntu Running 2
docker-desktop-data Stopped 2
and it solved the problem

second line on my system or python terminal now saying: “ -bash: zzzzz#: command not found“

I have been trying to pip install psycopg2 for some time now
I have just updated to python 3.7.4, before this problem started.
To set my path to a specific python version I used the code below.
nano .bash_profile
I thought that it would now be easy for my system to identify the path of the newly installed python, as to enable it to install psycopg2. Then the below started happening.
The second line of system terminal or python terminal is now always showing:
-bash: zzzzz#: command not found on my terminal
No matter what I type on my terminal, I am always getting command not found
This would mean you literally have "zzzzz" somewhere in the bash_profile. Bash is seeing "zzzzz" as just another command to run at startup like the rest of the profile script. As there is nothing in your PATH matching that string, bash reports the issue back to you.
Either remove the extra line from your .bash_profile. OR use a terribly wasteful work-around!
ln -s /bin/true /bin/zzzzz
This will create a symbolic link to the "true" binary (all it ever does is return true) from zzzzz. Now bash can find zzzzz and run it during start up, which does nothing. No more error and an absurd work around. You should fix the file.

Visual Studio Code Terminal cannot find `lesspipe` command

When I want to make some commands in Visual Studio Code terminal, it prints a message like this:
command 'lesspipe' is available in the following places
This also happens with dircolors. If I want to do something with git or sudo or some other command, it won't let me.
The text is in spanish.
command 'lesspipe' is available in the following places
* /bin/lesspipe
* /usr/bin/lesspipe
command not found because <</usr/bin:/bin> is not include in path variable.
I am assuming that you configured Visual Studio Code to use the default shell on Linux:
With that said and based on the error, it seems that there's something in your .bashrc (or .bash_profile) that messed up your PATH environment variable, something that removed /usr/bin and /bin from it. For example, if I put this some invalid commands at the end of my .bashrc:
/usr/bin/commandthatdoesnotexist
When I open a Terminal on VSCode, those errors will display like this:
bash: /usr/bin/commandthatdoesnotexist: No such file or directory
I suggest you check your .bashrc. I don't know exactly what you added to it so I can't reproduce your problem. Check if you modified the PATH environment variable (did you re-define it? did you accidentally exported it incorrectly?). If you did, temporarily remove those changes.
On an actual terminal (outside of VSCode), you can try to do the following:
$ echo $PATH
# Should display something like this:
# /home/gino/bin:/home/gino/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
If PATH is not like that:
$ export PATH=$PATH:/usr/bin:/bin
$ sudo vim /etc/environment # or sudo nano or sudo vi, whichever you use
Then edit PATH to look something like this:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
Then try the terminal on VSCode again. If it's working now, re-check your modifications on .bashrc to see which one is causing the problem.
I would suggest to logout of root
run
$ sudo nano /etc/environment
replace the path by
$ PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr>

Trouble setting up Sublime Text 3 to work with MongoDB [duplicate]

I'm using Mac Lion. I was using mongodb version 1.4. I wanted to upgrade to 1.8.5 and I followed http://shiftcommathree.com/articles/how-to-install-mongodb-on-os-x step wise replacing each mongodb-osx-x86_64-1.4.0 by mongodb-osx-x86_64-1.8.5. Everything goes smooth. I tried:
mongod
it's ok. I can access localhost:28017
but,
mongo
shows command not found
How can I fix this?
You need to add the path to "mongo" to your terminal shell.
export PATH=$PATH:/usr/local/mongodb/bin
Did you do the last step with paths.d? If so, try restarting your terminals.
Do you have a good reason for using 1.8.5? The current stable is 2.0.4, and it has many useful upgrades from 1.8.x
Starting from Mongodb version 6.0 mongo was replaced by mongosh
For readers in 2021:
export PATH="$PATH:/usr/local/opt/mongodb-community#3.6/bin"
You'll have to add the location of the Mongo binary to PATH.
Follow the steps below in order to make the PATH variable permanent:
Open Terminal and navigate to your user directory.
Run touch ~/.bash_profile and then open ~/.bash_profile.
In TextEdit, add export PATH="<mongo-directory>/bin:$PATH" (Keep the quote marks - related to white spaces).
Save the .bash_profile file and Quit (Command + Q) Text Edit.
Run source ~/.bash_profile.
Run echo $PATH and check if the you see that the Mongo binary was added.
(*) Notice that the PATH variable is now available only for the current terminal and not to processes that were already started in the session.
In order to make it available outside the current terminal - you'll have to logout and login.
1.Go to your [mongodb installation dir]:
cd <mongodb installation dir>
2.Type ./bin/mongo to start mongo:
./bin/mongo
Read More
Note :
If above command gives error
Failed global initialization: BadValue Invalid or no user locale set. Please ensure LANG and/or LC_ environment variables are set correctly.*
Run bellow command: Read More
export LC_ALL=C
How can find installation directory
find / -name "mongodb"
You can also set path
export PATH=$PATH:<mongodb installation dir>/bin
documentation
export PATH={mongodb-install-directory}/bin:$PATH
In Mac:
Go into Bash Profile:
vi ~/.bash_profile
Add Path of Installation of MongoDB:
export PATH=$PATH:/usr/local/opt/mongodb-community#4.2/bin
Reload the Bash Profile:
source ~/.bash_profile
You can navigate to the mongo directory using the command line and then start MongoDB with
./mongodb
I was facing the same problem this worked for me.
you need to install mongodb shell to ge the mongo command working.
Download link
I didn't have the right mongo command line tools installed. This from Brew worked for me though.
brew install mongodb-community
just a little recommandation, if your path has a space just wrap the whole path with quote or doublequote
example : C:\Program Files\MongoDB\Server\4.2 . notice the space in "Program Files"
export PATH=$PATH:"C:/Program Files/MongoDB/Server/X.X/bin"
in place of mongo command use mongosh command and it will work.

Mac OS X 10.11 - Add Postgres to $PATH Unsuccessful

I am trying to install Postgres in order to use Heroku.
I am following the instructions in the Heroku tutorial, and after Postgres installation (which was successful), it says to configure my .bash_profile to allow for Postgres command line functionality.
I am following the instructions here, but I am unable to successfully add this line:
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
That folder does in fact contain "psql" on my computer, so it should work. Here is my current .bash_profile:
# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
# The next line updates PATH for the Google Cloud SDK.
source '/Users/user/google-cloud-sdk/path.bash.inc'
# The next line enables shell command completion for gcloud.
source '/Users/user/google-cloud-sdk/completion.bash.inc'
I tried to add the Postgres line to the end of that file, but it is not working. After searching online, there does not seem to be consensus on how to add PATHs to .bash_profile. I have tried many versions listed, but none have worked.
Please let me know if I'm doing this incorrectly!
Add this line to the end of your .bash_profile:
export PATH=/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH
This makes the search of a binary to look in that location "BEFORE the rest of the PATH"
Kill all instances of terminal and open it again, then it should work.
Try which xxx where xxx is the name of some binary inside /Applications/Postgres.app/Contents/Versions/latest/bin and check if it's returning that location.
Tell me if it works.