Skip to main content
  1. Open TextEdit as sudo

     sudo -b /System/Applications/TextEdit.app/Contents/MacOS/TextEdit
    
  2. Open /etc/hosts in this new TextEdit instance using any of the following methods:

    • Append the path to the end of the previous command
    • Use File → Open
    • Drag the file to the sudo'd TextEdit on the Dock

Alternatively, you can edit in Terminal using nano:

SUDO_EDITOR=nano sudo -e /etc/hosts

Using sudo -e ensures that temporary files etc. are handled in the proper way and you don't run into permission issues with them. nano is a simple console-based editor which is quite user-friendly.

  1. Open TextEdit as sudo

     sudo -b /Applications/TextEdit.app/Contents/MacOS/TextEdit
    
  2. Open /etc/hosts in this new TextEdit instance using any of the following methods:

    • Append the path to the end of the previous command
    • Use File → Open
    • Drag the file to the sudo'd TextEdit on the Dock

Alternatively, you can edit in Terminal using nano:

SUDO_EDITOR=nano sudo -e /etc/hosts

Using sudo -e ensures that temporary files etc. are handled in the proper way and you don't run into permission issues with them. nano is a simple console-based editor which is quite user-friendly.

  1. Open TextEdit as sudo

     sudo -b /System/Applications/TextEdit.app/Contents/MacOS/TextEdit
    
  2. Open /etc/hosts in this new TextEdit instance using any of the following methods:

    • Append the path to the end of the previous command
    • Use File → Open
    • Drag the file to the sudo'd TextEdit on the Dock

Alternatively, you can edit in Terminal using nano:

SUDO_EDITOR=nano sudo -e /etc/hosts

Using sudo -e ensures that temporary files etc. are handled in the proper way and you don't run into permission issues with them. nano is a simple console-based editor which is quite user-friendly.

added 220 characters in body
Source Link
nohillside
  • 104.5k
  • 42
  • 222
  • 275
  1. Open TextEdit as sudo

     sudo -b /Applications/TextEdit.app/Contents/MacOS/TextEdit
    
  2. Open /etc/hosts in this new TextEdit instance using any of the following methods:

    • Append the path to the end of the previous command
    • Use File → Open
    • Drag the file to the sudo'd TextEdit on the Dock

Alternatively, you can edit in Terminal using nano:

SUDO_EDITOR=nano sudo nano-e /etc/hosts

Using sudo -e ensures that temporary files etc. are handled in the proper way and you don't run into permission issues with them. nano is a simple console-based editor which is quite user-friendly.

  1. Open TextEdit as sudo

     sudo -b /Applications/TextEdit.app/Contents/MacOS/TextEdit
    
  2. Open /etc/hosts in this new TextEdit instance using any of the following methods:

    • Append the path to the end of the previous command
    • Use File → Open
    • Drag the file to the sudo'd TextEdit on the Dock

Alternatively, you can edit in Terminal using nano:

sudo nano /etc/hosts
  1. Open TextEdit as sudo

     sudo -b /Applications/TextEdit.app/Contents/MacOS/TextEdit
    
  2. Open /etc/hosts in this new TextEdit instance using any of the following methods:

    • Append the path to the end of the previous command
    • Use File → Open
    • Drag the file to the sudo'd TextEdit on the Dock

Alternatively, you can edit in Terminal using nano:

SUDO_EDITOR=nano sudo -e /etc/hosts

Using sudo -e ensures that temporary files etc. are handled in the proper way and you don't run into permission issues with them. nano is a simple console-based editor which is quite user-friendly.

added 233 characters in body
Source Link
grg
  • 205.6k
  • 45
  • 364
  • 496
  1. Open TextEdit as sudo

     sudo -b "/Applications/Textedit.app/Contents/MacOS/TextEdit"
    
     sudo -b /Applications/TextEdit.app/Contents/MacOS/TextEdit
    
  2. Open /etc/hosts in this new TextEdit instance. using any of the following methods:

    • Append the path to the end of the previous command
    • Use File → Open
    • Drag the file to the sudo'd TextEdit on the Dock
 

Alternatively, you can edit within Terminal using nano:

sudo nano /etc/hosts
  1. Open TextEdit as sudo

     sudo -b "/Applications/Textedit.app/Contents/MacOS/TextEdit"
    
  2. Open /etc/hosts in this new TextEdit instance.

Alternatively, edit with nano:

sudo nano /etc/hosts
  1. Open TextEdit as sudo

     sudo -b /Applications/TextEdit.app/Contents/MacOS/TextEdit
    
  2. Open /etc/hosts in this new TextEdit instance using any of the following methods:

    • Append the path to the end of the previous command
    • Use File → Open
    • Drag the file to the sudo'd TextEdit on the Dock
 

Alternatively, you can edit in Terminal using nano:

sudo nano /etc/hosts
Source Link
grg
  • 205.6k
  • 45
  • 364
  • 496
Loading