Daily Tip: How to fix iTunes restore errors by manually editing host files on your Mac

Getting the dreaded "This device isn't eligible for the requested build" error when trying to install an iOS 5 beta, and wondering how to edit your hosts file to get around the problem? Host files can often be used to resolve issues with an iTunes restore, even those that happen due to SHSH saves on jailbroken devices. Follow along for a quick walkthrough, and I'll show you how.

If you're getting an iTunes restore error message, first you'll want to make sure your host file is the problem. As a side note, I am only demonstrating this on a Mac as I don't have a PC but much of the same commands and edits can be done through command prompt on a PC as well.

  1. Open Terminal

  1. Type in ping gs.apple.com and hit Enter

  1. If you see something other than bytes=32 as the reply, you'll need to edit your host file, so continue to the next section.
  2. If you do see the above, you may want to try forcing your device into DFU mode and then restoring. Or try restoring from a different computer as that seems to work sometimes. Your host file is not causing your restore to fail. Something else is causing it.

If you "do" need to edit your host file, follow the steps below to do so.



  • Right click on Finder in your dock and select Go to folder...

  • In the prompt, type /private/etc and hit Ok
  • You may be prompted to enter your password while editing or accessing some of these folders. Simply type in your admin password if asked.
  • Drag the Hosts file from the /etc folder to your desktop and then open it with TextEdit or a simliar program

  • You will need to add the following text to your host file: gs.apple.com (refer to the screen above)
  • Save the file and drag it back into the /etc folder where you originally pulled it from (choose to overwrite or replace if asked)

  • Now we just need to flush the cache in order for the changes to take effect. Open Terminal again and type in dscacheutil -flushcache and hit enter. (The command prompt entry for Windows users is ipconfig /flushdns
  • You should now be able to restore your device in iTunes without any issues.
  • Tips of the day will range from beginner-level 101 to advanced-level ninjary. If you already know this tip, keep the link handy as a quick way to help a friend. If you have a tip of your own you’d like to suggest, add them to the comments or send them in to news@tipb.com. (If it’s especially awesome and previously unknown to us, we’ll even give ya a reward…)

iMore senior editor from 2011 to 2015.

  • Will this work work when trying to downgrade iOS?
  • Or you could just edit it in since your already in the terminal.
    sudo nano /private/etc/hosts
    press control-o to save
    press control-X to exit editor
  • this did not work for me because my host file: gs.apple.com is already that.
  • woo hooo !! it works for me. Thks so much !! u're a life saver ^^
  • i did all what u said still doens't work for me. I'm tryin to upgrade 4.3.3 iPad1 3g + WiFi to 5.0.1 please HELP !!!! used pwanage tool used redsnow. I seriously give up on this because i have never faced such problem earlier. Please reply on my email if possible.
  • Delete the gs.apple line. This should allow connection to the real apple servers! If not delete the whole host file
  • P S : also when i ping it says connection timed out.
    PING gs.apple.com.akadns.net ( 56 data bytes
    Request timeout for icmpseq 0
    Request timeout for icmp
    seq 1
    Request timeout for icmpseq 2
    Request timeout for icmp
    seq 3
    Request timeout for icmp_seq 4
  • Delete the gs.apple line. This should allow connection to the real apple servers! If not delete the whole host file
  • This worked fine on iphone 4 going up to 6.0.1 MBP osx 10.8. very grateful !
  • This worked for me. Even though my host file was already the " gs.apple.com" - I deleted it and retyped it higher up than where it was originally posted. I also had a "# gs.apple.com" below it that I just deleted. Worked great!