Skip to content

Instantly share code, notes, and snippets.

@joaoBeno
Created May 21, 2016 10:08
Show Gist options
  • Save joaoBeno/c4730205580569ab1102db42392b05eb to your computer and use it in GitHub Desktop.
Save joaoBeno/c4730205580569ab1102db42392b05eb to your computer and use it in GitHub Desktop.
How to circumvent slow as hell Mac App Store dowload...
So, you have a somewhat fast connection, but Apple decided you should have the latest Os X (Or some other app) in 3 days?
Let's change that!
The idea is simply to get the Apple download URL, download the file using some download accelerator, then fake the server on localhost
so App Store download it from your computer instead of the internet!
So, now the instructions (That I found over here: https://7labs.heypub.com/tips-tricks/el-capitan-direct-download.html):
1) Open App Store, then go to the app you wish to download, let the screen there and open a terminal window
2) Type the command below to open your computer's host files (This files store a sort of list relating ip's to domains)
sudo nano /etc/hosts
3) On the file add the following entry at the end of the file
127.0.0.1 osxapps.itunes.apple.com
Note: If there are other entries like this, comment them all by putting an # at the begining of the line!
4) Ok, now press [CTRL]+X, then it will ask for confirmation, press Y, then [Enter].
5) Type this command to flush your DNS cache:
sudo killall -HUP mDNSResponder
6) Now do this command to go to your desktop:
cd ~/Desktop
7) Now let's create a new folder, where we will host our file.
mkdir osxapps_local
8) Then enter the new folder with
cd osxapps_local
9) Now we will run a server in python, so we can get the URL the App Store will look for the file:
sudo python -m SimpleHTTPServer 80
Note: If a warning window appear, just hit "Allow"
10) Ok, open the App Store and hit download, it will give an error, it's ok, switch back to the console, and you
shall see something like:
127.0.0.1 - - [21/May/2016 03:29:31] code 404, message File not found
127.0.0.1 - - [21/May/2016 03:29:31] "GET /apple-assets-us-std-000001/Purple20/v4/74/6d/fc/746dfc4d-e202-9cf7-9ec2-4552c7f5af4a/flu3946531886475738859.pkg HTTP/1.1" 404 -
This last line is what we want!
11) Hit [CTRL]+C to stop your server.
12) Open the hosts file again, like on Step 1, and put a # at the begining of the line you created, then save as
shown on Step 4, and do the command specified on Step 5.
13) Now go to your browser (I recommend Firefox!) and open the URL formed by this: "http://osxapps.itunes.apple.com"
and the content of the line mentioned on Step 10, after the "GET " until the end of ".pkg", PAY ATENTION TO THE SPACE!
It will form a URL like:
http://osxapps.itunes.apple.com/apple-assets-us-std-000001/Purple20/v4/74/6d/fc/746dfc4d-e202-9cf7-9ec2-4552c7f5af4a/flu3946531886475738859.pkg
Then hit enter and follow your usual download procedure! Ah, and please DON'T close the terminal window yet!
14) When the download is complete, take the URL from where you downloaded, now we will create the local file structure.
Copy it to the text editor, and remove the "http://osxapps.itunes.apple.com/" from the begining, and the "a-lot-of-characters.pkg"
from the end. Now go back to the terminal window, and type the folowing command, BUT DO NOT HIT ENTER YET!:
sudo mkdir -p ./
then paste the text from your text editor right after the "./", so it will end up like this:
sudo mkdir -p ./apple-assets-us-std-000001/Purple20/v4/74/6d/fc/746dfc4d-e202-9cf7-9ec2-4552c7f5af4a/
Now you can hit enter!
15) Ok, now open Finder and navigate to your desktop, to the folder we created, and go in all the folders inside one another,
until there is no more folders to enter. Open a new Finder window and copy the file you downloaded onto this folder.
16) go back to the terminal, and do the command from Step 1, and remove the # from the line we created. then save it as in
Step 4 and run the command on Step 5 again! After that, run the command from Step 9, and go to the App Store and hit download
again. Now it will download super fast, as it is just copying the file from your computer to the place it should be.
17) We are done! After the install finishes, close App Store, press Control+C on the terminal to stop your fake server,
then run Step 1 again and undo all alterations you did. Then do Step 5 again to clear the DNS cache, and close terminal.
You can delete the folder you created at the desktop and the file you downloaded.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment