iOS update error 1013

Tonight I decided to update an iPhone 4 to iOS 4.3.1. I sync my phone regularly and have never encountered an update problem. That changed tonight as the 4.3.1 update failed about five times in a row with error code 1013.

Clicking “more info” on the error message led me to this page which mentioned a possible problem connecting to gs.apple.com. I fired up a browser and tried http://gs.apple.com and was greeted with an Apache server directory listing. I figured since I got a response (and not a connection error) the problem must have been elsewhere, so I tried other suggestions from the support article: updating OSX, updating iTunes, changing USB ports, and rebooting. After each one, no luck: still the 1013. I began to sweat.

I read the support article closer, and even visited a large thread on the support forums and decided to peek at the /etc/hosts file. Sure enough, there was an entry for gs.apple.com! Where’d that come from?

I used a real man’s editor and commented out the entry for gs.apple.com. The very next restore attempt succeeded on first try.

$ sudo vi /etc/hosts
Password:

Enter your own password at the prompt and press return.

Your hosts file may be slightly different, but you’ll want to comment out the entry for gs.apple.com.

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost
#74.208.10.249 gs.apple.com
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/etc/hosts" 11L, 264C

The important part is adding the # at the beginning of the line with gs.apple.com.

Note: if you’ve gotten this far but need help with the editor in this example itself, leave a comment and I can walk you through it. It’s the “vi” editor and it’s not very straightforward if you’re not used to the command prompt scene… there are several good quickstarts available online as well.

Update 4/5/2011: a good tutorial on editing the hosts file in general can be found here.

Hope this helps someone,

-Scott

Update 4/5/2011: Here are the detailed steps on how to edit the system hosts file.  These are instructions for OSX Snow Leopard. (I think with Windows you can just edit the file in Notepad; the file is located at C:\Windows\System32\drivers\etc\hosts)

Update 4/27/2011: Here are a couple of articles from Macworld Magazine which explain why this may have happened.

OSX Snow Leopard instructions

  1. Open the Terminal app.
    Click on the spotlight icon (magnifying glass in the top right corner of your screen) and type “terminal”.  You should see a black square looking icon; click it.
  2. Edit the Hosts file.
    I believe you need to be using an account with administrative privileges.
  3. Once Terminal.app opens, click on it and you should be able to type at the blinking cursor.
  4. Type the following:
    sudo vi /etc/hosts
  5. Press the enter (or return) key.
  6. The terminal will ask you for your password. Type it carefully, because for security reasons it won’t show on the screen.
  7. Note: if you mistype your password, you should see “Sorry, try again.” up to three times.
  8. If you correctly entered your password, the editor will show you the contents of the hosts file.
  9. You should see a few lines like the example above.
  10. Use the down arrow key to move the cursor to the line that has “gs.apple.com” in it.
    Leave the cursor on the first character in the line.
  11. Important: press the I key once.
    This puts the editor in “insert” characters mode so you can type inside the file. We’re not in Pages or Microsoft Word, and this editor is not very forgiving –  so type carefully.
  12. At the beginning of the line that has “gs.apple.com”, type a single hash (also known as pound) character.
    It’s above the 3, so press the shift and 3 keys at the same time.  If a 3 shows up instead of #, press the delete key to correct.
  13. The line should change colors.
    The # character tells the system to ignore this line in the file, which is what we want.
  14. Press the colon ( : ) key once.  That’s the shift and semicolon ( ; ) keys at the same time.
  15. Press the x key once.
  16. Press enter.
    The :x command tells the editor to save and exit.
  17. Close and restart iTunes
  18. Re-attempt the iOS update or restore.
About these ads

2 thoughts on “iOS update error 1013

  1. j says:

    Hey, I think you’re fix may work for me because the common fix isn’t, but I don’t understand what you did or how you did it. I keep getting the error and I’ve done the common fix like 6x now. Please help. This is my phone! ha

  2. Hi, was there a particular step you need help with? I’ll post some step by step instructions here shortly.
    I’ve posted updated instructions. Are you using Windows or a Mac?

    -Scott

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s