I have this issue with bash on a MacBook Pro (chip M1, OS: 12.5.1). It’s been there since day1.

  • I set bash as the default shell in Terminal>Preferences>General enter image description here
  • I create and modify a new bash_profile file in my ~ folder using vi so I can exclude line-ending issues, formatting issues due to the editor, and such

  • Most of the commands I write in the .bash_profile file do not work. For example, echo seems to work; source returns “No such file or directory” even when the file actually exists and the path is correct; ls and many others give “Command not found”. All those commands run in the terminal with no problems at all

  • the $PATH variable seems okay. export doesn’t return an error message. Without appending new paths in bash_profile, I have /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin, which is what I expect looking into /etc/paths.d/

  • for example, the line export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH" to bash_profile doesn’t produce any error when sourcing the file; the line source "/Volumes/Macintosh HD/Applications/root_v6.26.06/bin/thisroot.sh" (file, path verified) gives No such file or directory

  • the /etc/paths file is still untouched:


  • probably part of the same problem, the terminal overwrites the lines that are longer than the window length

  • among the attempts to solve the problem, I updated bash to a more recent version, 5.1.0; bash --version responds accordingly. Same errors.

  • the issue was there with previous OS versions as well. Updating didn’t help

Hopefully, someone who ran into the same issues can share some good hints. Thanks!

matt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.