MacOS – How to edit hosts with TextEdit on Yosemite

hostsmacosterminaltextedit

This line used to work
sudo -b "/Applications/Textedit.app/Contents/MacOS/TextEdit" /etc/hosts

But on Yosemite, it does not work anymore.

Best Answer

Yes I just tried your command and it exists with error code 132 (I don't know why).

You can still use this to open your hosts file sudo open -t /etc/hosts. It will open the TextEdit app, if you want to run it in the background you can add your -b in the command line. Or you can use other text editors like vim and nano they're both working perfectly with Yosemite.