4

I receive this error message each time I launch terminal:

-bash: =/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin: No such file or directory
tripleee
  • 175,061
  • 34
  • 275
  • 318
jmickel
  • 43
  • 1
  • 4
  • I would bet that one of the bash_profile files has something like `$NONESUCH_VAR=usr/local/bin:$PATH`. So the nonexistent variable disappears and the cmd-line tries to "run" `=/usr/local/bin:/usr/local/bin:...` . Try `grep '^$' .profile .bash_profile .... ` Good luck. – shellter Mar 25 '15 at 03:03

2 Answers2

2

You have recently edited one of your shell's startup files and introduced an error.

Probably, ls -lart ~/.bashrc ~/.bash_profile ~/.profile will indicate which one -- if one or more is missing, that's no concern, we just want to see which one out of these you have edited recently. Examine the time stamps and try to remember what you did to change one of these files.

The error probably looks something like

$oopsPATH=/usr/local/bin:$PATH

where you meant to say

PATH=/usr/local/bin:$PATH

but without access to your files, we can't know what exactly is supposed to be there, or how you messed it up.

See also https://askubuntu.com/questions/198730/how-to-restore-bashrc-file/198740#198740

In the common case where you have messed up your PATH so that ls and other commands are unavailable (bash: ls: command not found), you can use the full path (/bin/ls pro ls, etc; though obviously, you have to know the correct path) at least until you can restore your configuration.

PATH=/usr/local/bin:/usr/bin:/bin

is probably a good crutch until you can find the correct default for your OS. You can type that at the prompt, or put it in one of your shell's startup files and start a new shell.

On many platforms, you can find the default user dot files in /etc/skel so if that's present (which unfortunately will not be true for Mac OS, but should be there on most Linuxes):

 cp -b /etc/skel/.bash_profile $HOME/

will replace your (presumably broken beyond repair) .bash_profile with the system default one. (Omit the -b option if your OS doesn't have it, but then you'll want to back up your file manually before replacing it.)


Update: This fragment near the top of your .bash_profile is erroneous:

#loginPath
=/usr/local/bin:$PATH

Just take it out; it doesn't seem to do anything useful. There seem to be multiple additional fragments from the MacPorts installer which look wrong, too, but they are just comments. (Perhaps somehow they shouldn't be?)

Community
  • 1
  • 1
tripleee
  • 175,061
  • 34
  • 275
  • 318
  • Thank you. This is what I get when I use the code you suggested: `ls: /Users/jeremy/.bashrc: No such file or directory -rw-r--r-- 1 jeremy staff 197 Mar 24 15:23 /Users/jeremy/.profile -rw-r--r-- 1 jeremy staff 956 Mar 24 15:23 /Users/jeremy/.bash_profile` – jmickel Mar 25 '15 at 20:11
  • So do you see anything involving `PATH` in either `.profile` or `.bash_profile`? Did you really edit them both recently? – tripleee Mar 25 '15 at 20:22
  • The error message has been there for a long time, and I'm just now trying to figure out how to fix it. I'm running into problems trying to reinstall Homebrew and TTFautohint, and thought maybe this was the root of the problem. Thanks for your help. – jmickel Mar 26 '15 at 16:32
  • Given that the files are small, simply uploading them to https://pastebin.com/ and adding a link here might be a good way forward. – tripleee Mar 26 '15 at 16:34
  • I was going to ask about Homebrew and friends, actually; some of these have install scripts which modify your `.bashrc` and sometimes they manage to mess it up. – tripleee Mar 26 '15 at 16:36
  • Also for the record, do you have a `.bash_login` file? I seem to have one on OSX, but it looks like I created it myself. – tripleee Mar 26 '15 at 16:36
  • Thanks -- I'm happy to share any files, but I'm not clear on how to access `.bashrc` or `.bash_login`. – jmickel Mar 26 '15 at 21:17
  • `less $HOME/.bashrc` shows your `.bashrc` file on your display. Or if you have a text editor, open it in that, and copy/paste to Pastebin. – tripleee Mar 26 '15 at 21:19
  • I seem to not have a file. When I enter `~/.bashrc` I receive this message: `-bash: /Users/jeremy/.bashrc: No such file or directory` – jmickel Mar 26 '15 at 21:19
  • Uh, yeah, that's the one you don't have. The other two should be sufficient. You cannot upload files you do not have. – tripleee Mar 26 '15 at 21:20
0

It seems that you are missing a necessary PATH and that is why it is saying no such file or directory. If, for example, you get this error message when typing in python, it would mean either that (1) python isn't installed; or (2) python isn't on your system path.

David542
  • 104,438
  • 178
  • 489
  • 842
  • Thanks. When I `$ echo path` I get this message. Does that tell you what's not installed correctly? `/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/jeremy/bin/FDK/Tools/osx` – jmickel Mar 25 '15 at 02:34
  • No, that would not manifest when you start a new terminal, only when you try to run a command. The problem description seems to indicate an error in one of the shell's startup files (probably @shellter hit the nail on the head). – tripleee Mar 25 '15 at 08:09