The steps in the previous section are easy enough, but if you want to avoid copying the hosts file you can edit it directly in Terminal using You should use a different editor that can have How to Edit Your Mac Hosts File In Terminal With Nano. How to edit a file from the command line Mac OS X?, I suspect this is because the permission elevation is for the open command, not TextEdit itself. Otherwise, use one of the command-line editors included with macOS: If you want to use a graphical text editor, use TextEdit (in Launchpad). For general-purpose work, it’s easiest to use one of the text editors included with macOS. To edit a plain text file in Terminal, you can use a command-line text editor. Use command-line text editors in Terminal on Mac. Use command-line text editors in Terminal on Mac, In Terminal on your Mac, edit plain text files with a command-line editor.