Whoops! Atom as terminal editor mistake



I wanted to use atom as my texteditor instead of vim…

Well I followed this link stackexchange example to change this with a texteditor app.

I did the following before my Mac almost broke!!
> Add to ~/.bashrc: export EDITOR=/Applications/TextEdit.app/Contents/MacOS/TextEdit
> echo “export EDITOR=/Applications/TextEdit.app/Contents/MacOS/TextEdit” >> ~/.bashrc

The first line I did in! ~/.bash_profile EDITOR=/Applications/Atom.app/Contents/MacOS/Atom
Then I did the following NOT in the ~/.bash_profile but just in terminal because that seemed the way to do it which is defenitely not the way!echo "export EDITOR=/Applications/Atom.app/Contents/MacOS/Atom" >> ~/.bash_profile

This made it all go wrong, atom.app just kept on restarting and multiple Atoms opened one after another. I found a gap where I was able to delete to Atom.app so I couldn’t get started again!!! Which saved my Imac from crashing. But now I can’t install Atom again without having the same problem. also I remove the first line in my ~/.bash_profile but still after opening a new terminal I get following error :-bash: /Applications/Atom.app/Contents/MacOS/Atom: No such file or directory

So my guess the second line in the first code broke it, how and where can I remove it? I hope somebody can help me!!
Otherwise I’m stuck reformatting my freshly reformatted and fully installed Imac again just before a major deadline…


Have you tried rebooting your computer since you removed that first line from ~/.bash_profile?



But I might have found it myself already, there was a duplicate line of code way down in my bash_profile.

Deleted it and going to restart to see if that’s it.


There’s a duplicate line of code because you interpreted the instructions as two instructions, but it was really meant to be one. The easiest way to add a line to a file from the command line is to do the echo "new line" >> file.txt command.