'Somehow broke my terminal when exporting a PATH [duplicate]

I followed this answer on Stackoverflow. After I executed the command, no other commands work from any plugin. Can't even run git status on a local repo. I just get the error zsh: command not found:

Iterm doesnt even display the branch name next to the file path, so something is seriously up... Any ideas?

This was the command in my case: export PATH="/Users/tillman/.local/share/gem/ruby/3.1.0/bin:$PATH"

Terminal within VS Code works fine, but iTerm does not.

Problem is I can't actually see the above path added to my .zshrc file. So I don't know where to go from here.



Solution 1:[1]

Found out the solution via this answer.

I still don't totally know why this works, so if anyone has the time to answer it would be great. The commands were not working because of every one of these paths. Each one broke my shell:

  • export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:$PATH"
  • export PATH="$HOME/.gem/ruby/3.1.0/bin:$PATH"
  • export PATH="$HOME/.local/share/gem/ruby/3.1.0/bin"

But these commands came from the Jekyll install guide. After running these commands once, my terminal still worked for days (terminal was restarted multiple times between different sessions after running those commands). It was only after running the export command from the OP where everything broke. From there, I had to delete the above three export commands before the shell would work again...

Really confusing. Particularly as the export command never actually ended up in my .zshrc file after running it at all....

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 serverSnake