1

I have been trying to install blastn on my mac, but while doing messed up my bash command i guess (not a specialist...)

- using the nano command nano ~/.profile
- i`ve changed my PATH; export PATH=/Users/YourName/blast-2.2.22/bin:${PATH}
- now i can not run any command anymore in the terminal (also other shell)

-bash: export: `/Users/Tom/ncbi-blast-2.6.0+/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/ncbi/blast/bin': not a valid identifier

As i'm not a specialist, i'm stuck how to change things back...

  • Try it with quotes: export PATH="/Users/YourName/blast-2.2.22/bin:${PATH}" – Argonauts Jan 10 '17 at 14:54
  • 1
    Thanks, but the problem is i can t run anything in terminal anymore... and don`t have a clue to change it back to the original settings – Tom Viaene Jan 10 '17 at 14:59
  • Paste the export command directly into the terminal and it should take effect immediately. Assuming that works you can then edit the file – Argonauts Jan 10 '17 at 15:16
0

Three steps: First, you probably can run commands from the terminal. You just somehow messed up your search path. But you can still start a program by specifying its full path.

E.g. /usr/local/bin/bash would still start bash, even if /usr/local/bin/ is not in your search path. (adjust the path as needed, I have no idea where OS X stores bash by default. I just used the location where bash is on FreeBSD).

So, yes, you can run commands. And you can use those commands to fix things.


Secondly, you might not need to look up all the paths. Setting a new path for your current shell should be as easy as typing export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" and pressing enter or return. This is only temporaily for the open shell, but it will make recovery much easier.


Thirdly, lets try to find the error and permanently fix it.

The error message is quite clear. Quoting your own post: export: /Users/Tom/ncbi-blast-2.6.0+/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/ncbi/blast/bin': not a valid identifier

Somewhere in your edits is an error. Open the .profile again either by temporarily restoring paths (see section 2) or by specifying the full path.

If you have a backupfile, restore that. If not look for entries like this:

PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/mysql/bin:$PATH or
`PATH="$PATH:/newfoldertosearch"

Locate your own edits. Remove them (or uncomment by placing a # in front of them and then try to locate the error. It can be as simple as having a ; instead of an :. Other easy to miss things are spaces or non-printable characters.

While editing this do not close your current shell. Keep the known working (or known temporarily restored one) open and test in a second shell. Which is good practice for any edits to your profile.



PS: The plus sign at the end of ncbi-blast-2.6.0+ in an unquoted string might be the case, but I got no OSX to test with.

0

This should reset your PATH variable to its default value and get your commands working again:

PATH=$(getconf PATH)

Then, instead of using

export PATH=/Users/YourName/blast-2.2.22/bin:${PATH}

use:

export PATH="$HOME/blast-2.2.22/bin:${PATH}"

Finally, assuming you are adding the PATH definition to a .profile or .bashrc, you can test the changes by executing bash -l. This will invoke bash as a subshell, but it will run as if you logged in. You can test to see if the changes are working as you want and then type exit to terminate that subshell and return to your original login shell.

0
  • now i can not run any command anymore in the terminal (also other shell)

This part of your problem was happening to me, so what I did was:

1) typing export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" into the terminal in order to make it temporarily working

2) Editing bash_profile by typing /usr/bin/open ~/.bash_profile -a TextEdit

3) When I opened my bash_profile file I realised the last line export looked really messy with some strange symbols, so I canged it entirely to export PATH=/opt/local/bin:/opt/local/sbin:$PATH

I'm an absolutely beginner at this but I managed to get those steps by reading pieces of solutions from different questions on SE, so hope it could help someone else.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.