High Sierra: "An error has occurred" and app won't finish downloading I am trying to download the latest version of Xcode from the AppStore so I can continue with my development. I am on a MBP 2016 touch-bar running MacOS High Sierra 10.13.4. I did a lot of digging and can't seem to find anything recent or something that works.

Xcode will download part of the way, but if I disconnect from the WiFi or leave my computer closed for too long it will tell me "An error has occurred" when I come back to it to check on it. The "An error has occurred" message will not go away to let me start up the download again. The only way to fix this (that I know of) is to completely restart my computer. This causes all my download progress to be lost (I live in a country with really bad internet, so I can't just download it in an hour like in America) 

I've tried:


Restarting my computer (this works but I lose all my download progress)
resetting the storedownloadd in the activity monitor
activating the debug menu (it doesn't activate no matter what I tried)
signing out and signing back in


How do I force the download to restart and get rid of "An error has occurred" message?
I helped someone about three weeks ago with the same issue. What worked for them was resetting the System Management Controller and then starting the download again, but this time with their energy saver settings temporarily changed so that their MBP did not go to sleep at all. 

Resetting the SMC

To reset the SMC on your model MBP, follow these steps:


Shut down your MBP
Unplug the power cable from your Mac
For 10 seconds, press and hold at the same time the shiftcontroloption keys (on the left side of the built-in keyboard) and the power button
After 10 seconds let go of all keys and the power button 
Plug in the power cable
Turn your MBP back on with the power button.


Temporarily change your Energy Saver settings

Now ensure your Energy Saver settings (Apple > System Preferences > Energy Saver) mimic the following:



You can change your settings back again after the download works. If it doesn't work, then you'll know it wasn't some sort of power management issue at your end interrupting the download.

Of course, it goes without saying that you should keep your MBP connected to an AC power source (i.e. the Power Adapter) while trying this.