March 18, 2011, 4:15 PM — After iOS 4.3 was released, I dutifully attached my iPhone 4 (running iOS 4.2.1) to iTunes and selected to Update. I wasn't expecting any trouble. My iPhone had never been jailbroken or modified in any unauthorized way. I was running the latest version of iTunes. This was a completely mundane task. What could go wrong?
Apparently, quite a bit.
After successfully downloading the update file and initiating an install, an ominous message popped up in iTunes--informing me that the update had failed due to a 1013 error. Adding insult to injury, the message further noted that my iPhone was now in "recovery mode" and I would need to restore the iPhone to get it working again. Confirming this, the "Connect to iTunes" screen was glaring from the iPhone's display.
Uh-oh. While I could see that my afternoon plans were now in jeopardy, I wasn't yet concerned about the ultimate outcome. I would do the time-consuming restore and be on my way.
iTunes had different plans. After clicking to Restore, I wound up with the exact same 1013 error at the exact same point in the installation process. Now I was concerned.
It was time to check Apple's support articles--notably the article that lists the various iOS alert messages and what they might mean. Here I learned the following:
"This error may be the result of the connection to gs.apple.com being blocked, redirected, or interrupted. Adjust your hosts file or security software to ensure that connections to gs.apple.com are not blocked."
Here's what this means: At least with more recent (iPhone 3GS and newer) iOS hardware, Apple requires that iTunes check in with its gs.apple.com server before permitting any update or install. From Apple's perspective, the purpose of the check is to prevent installation of "unauthorized" iOS versions. If iTunes can't reach the server to make the required check, you get the 1013 error. That's what was happening to me.
At this point, I knew why this was happening--and was a bit embarrassed that I had not realized the cause right away. While I had never jailbroken this iPhone, I had experimented with jailbreaking other iOS devices I owned. In particular, mainly as part of research for an article I had written, I had attempted to downgrade the iOS version of an iPod touch. As I explain in more detail in the just cited article, this requires adding a line to the Mac's host file (located in the /etc directory) to redirect iTunes from checking Apple's gs.apple.com server to instead checking the Cydia server or a local TinyUmbrella server.