If someone who is facing this problem is using Windows, try these steps. It worked for me.
Open notepad as administrator. Click File then click open. Direct yourself to C:\Windows\System32\Drivers\etc . Type hosts and press enter. Add this "# 127.0.0.1 gs.apple.com (add a hash and press tab then type 127.9.9.1 gs.apple.com)" to the bottom. Save and close notepad. Restart the itunes.
For what it's worth, I ended up needing to use a different Internet connection.
I'm not sure if it's my ISP doing something weird, or my router. I ended up connecting via a 3G router that I happened to have with me home from work, and that worked.
The really weird thing is that gs.apple.com resolved correctly via traceroute, so I could tell it wasn't an entry in my hosts file that was to blame.
I had exactly the same problem.
I added to the hosts file the last line
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
# 127.0.0.1 gs.apple.com
Then I read the first reply which is to sign out of iTunes then sign in. I realised quickly that my password on iTunes was out of date. Put the new password in and it worked a treat.
I don't know if adding the extra line made it work or if it was just a case of having the correct username and password in iTunes.
I also disabled my firewall for the update as well to ensure the ports were open, but i doubt this helped.
Hope this helps.
I'm using a 2010 Mac mini and have had IOS 4 updates previously without problem.
I upgraded to Lion recently which updated iTunes to ver 10.5
Since then iTunes has tried to update the iPhone repeatedly and got stuck at the "iPhone software update server could not be contacted or is temporarily unuavailable" part every time.
I can ping the server and for gs.apple.com get 184.108.40.206 and my hosts file didn't have the loopback entry for that server anyway so the server IS available and has done a few IOS 4 updates in the past.
Any clues for this set of circumstances?
Maybe I should reload Snow Leopard and forget Lion?
so that'll be a no then :-(
I now can't get anywhere. when I click update itunes immediately pops up "the iphone software update server could not be contacted" without asking if I want to proceed and then doing a backup before failing.
I can still ping gs.apple.com is this the update server or what it the host name of the update server?
Any clues out there?
After consulting a Linux guru mate who said "you updated to lion! you *******"
So, following his advice I connected the phone to a machine running windoze7, installed itunes and did the upgrade through there.
Seemless although there was no backup to restore. Doing that now back on the Mini.
So I just bought a 12" EeePC running windoze7 to go forward with.
Hopefully I'll get enough selling the mini to pay for the EeePC. Didn't like the new version of Lion email anyway so no great loss.
Apple need to make itunes available for Linux then I can have the best OS
after trying all day long, i finnaly solved that issue:
On a mac, click on finder.
on top, click on go=> Go to folder.
in the window that pops up, type "/etc" (without quotes).
on the new finder window locate Hosts file, and drag it to desktop.
open it with textedit, and if you find any line involving gs.apple.com (ex: 127.0.0.1 gs.apple.com) add a # in the begining of the row.
ex: if you find this: 127.0.0.1 gs.apple.com
make it look like that: # 127.0.0.1 gs.apple.com
Note: there may be more than one line as seen above, repeat as many times as needed.
save hosts file, drag it back to /etc folder (authentication may be required) replace it, and close finder.
BaranCan's tricks worked perfectly for me using Windows Vista 64bit Ultimate. I couldn't save the change in the host file so...the only additional step I had to do was to go to the "host" files Properties and uncheck the "read only" option. This is probably pretty basic but hopefully it will help a few.
I'm now downloading 5.0 as I type.