In the Finder, choose Applications > Utilities.
Open Terminal.
Enter this command and press Return:
sudo nano /private/etc/hosts
Enter the password you use to sign in to your computer and press Return. You won't see text appear in the Terminal window when you enter the password. Make sure you use a nonblank administrator password.
Terminal will display the hosts file.
Navigate using the arrow keys and look for an entry containing “gs.apple.com”.
Add the # symbol and a space ("# ") to the beginning of the gs.apple.com entry.
Press Control-O to save the file.
Press Enter when asked for the filename and Control-X to exit the editor.
Restart your computer.
Try to update or restore your iOS device again