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.
Best Answer
You probably want to look in your
~/.bash_prompt
file, or whatever file is settingPS1
(the shell prompt format) for you. YourPS1
variable is referencing the Git prompt function, which I assume got uninstalled or something. You'll want to remove the$(__git_ps1 " (%s)")
part from yourPS1
value.