How to edit hosts file using Terminal on a Mac

iPad Jailbreak
// December 11, 2011

If you are getting errors in iTunes while trying to restore a jailbroken iPad, iPhone or iPod touch you will need to edit you hosts file. There are a few ways to do this on a Mac but the simplest way is using Terminal.

  1. To get stated open the Terminal app. You can search for Terminal using Spotlight, or by go to Applications -> Utilities -> Terminal.
  2. After Terminal is open paste or type;

    sudo nano /private/etc/hosts

  3. Then press Enter and enter your password when prompted.
  4. Find the address “” (or something to that effect.) This is what you will need to delete, it’s normally at the end of the hosts file.
  5. You can navigate the file in Terminal using the arrow keys. After the address is deleted, press control-o to save the file then press enter.
  6. You can press control-x to exit the editor.

Your hosts file should now be edited. You can verify that it was edited by opening the file and seeing that the line was removed. You can open it in Terminal as in step 2 or you can open Finder, click “Go”, then “Go to Folder”, type /etc/ and press return. You can then find and open the hosts file.

Now you should be able to restore your device in iTunes.

iPad Jailbreak

Leave a Reply