Changes to .bash_profile causing Terminal shell to not load but keep looping with PATH settings

bashterminal

I was trying to make some changes with PATH (mostly add a new PATH) to my .bash_profile and the last line entered was source .bash_profile.

After I saved and restarted the Terminal app, instead of the shell prompt I see PATH values continuously popping up on my Terminal window tab. Only CTRL+C will kill it but now I see 'Application Closed' message and that's the end of it. What do I do to restore the shell back to my previous status? I tried running the repair permissions under Disk Utility but that didn't seem to fix my issue.

Thanks in advance.

enter image description here

Best Answer

You should remove the line:

source .bash_profile

from your .bash_profile. This line is causing the infinite loop by continuously loading the file. As you have discovered, repairing permissions will not solve this issue.

Since you can't access terminal, you can edit your .bash _profile in TextEdit. Here's how to do so:

  1. Open TextEdit Application and select Open (under File).
  2. Navigate to your home folder.
  3. .bash_profile will not be shown by default, since it begins with a period and is hidden. Type Cmd-Shift-. to view all hidden files.
  4. Then, open up your .bash_profile and remove the source .bash_profile line.
Related Question