Downloading Apple’s Server.app installer package
As part of building a custom OS X installer ISO for my ESXi server, I wanted the ability to include Server.app as part of my installation process. One problem with that is that Server.app is only available via the Mac App Store and doesn’t have a separate installer available for download.
However, if you have already purchased Server.app, it is possible to get a copy of the Server.app installer from the Mac App Store. See below the jump for details.
To install Server.app, the Mac App Store will download an installer package from Apple, install Server.app, then delete the installer package as part of the post-installation clean-up. However, it is possible to make the App Store leave behind a copy.
1. Go to a machine that does not have Server.app installed.
2. If it is open, quit out the App Store application
3. Open Terminal and run the following command:
defaults write com.apple.appstore ShowDebugMenu -bool true
4. Launch the App Store application. It should now have a Debug menu showing.
5. If needed, sign into the App Store and go to Purchases. From there, find OS X Server.
6. Begin the installation process for OS X Server, then click the Pause button to pause the download.
7. Under the Debug menu, select Show Download Folder…
At this point, you should see a folder inside the displayed folder. In that directory, you’ll see a package with a long randomized name. That will be the Server.app installer package.
8. In Terminal, run the following command:
ln /path/to/package_from_mac_app_store_name_here.pkg /path/to/name_you_want_to_save_package_as_here.pkg
Using the ln command will set up a hard link to the downloaded installer package. This will create name_you_want_to_save_package_as_here.pkg in the location specified, which is then linked to the contents of package_from_mac_app_store_name_here.pkg. The reason to do this is that the hard-linked name_you_want_to_save_package_as_here.pkg will not be deleted when the Mac App Store deletes package_from_mac_app_store_name_here.pkg from the Mac as part of the post-installation cleanup.
9. Go back to the App Store and click the Resume button to have the installation complete.
10. Once the installation finishes, name_you_want_to_save_package_as_here.pkg will available as a signed Server.app installer package. From there, you can use it on its own or as part of a deployment workflow.
Hat tip to @tvsutton for letting me know about the Mac App Store’s Debug menu and how to use hard links to capture downloads from the Mac App Store.
What a great find! Thanks
Let’s take this one step further… have you discovered a way to take this installer package, use it to “update” a remote server and then automate the steps where it “upgrades” the services?
If you unload the installer daemon before installing from the MAS you don’t need to bother with the pause/hard link/resume step for each application you want to capture.
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.installd.plist
When attempting to install an application from the MAS at the time of installation you’ll be greeted with an error: “The application could not be downloaded. There was a problem with the system installer tool.”
If you don’t click the Cancel or Retry buttons you’ll be able to browse to ~/Library/Application Support/AppStore to access your packages.
This should make things easier if you’re getting the latest updates for multiple MAS apps.
/System/Library/LaunchDaemons/com.apple.installd.plist: Operation not permitted while System Integrity Protection is engaged
El Capitan. Sierra too, unsurprisingly.
You. Are. Awesome. Thanks!
…enabling the debug menu is not working for me in 10.8.5 – is this a 10.9 thing?
Geoff,
It’s working for me on 10.8.5. You may need to quit the App Store and relaunch it before it appears.
Nope. I was writing to ~. My bad. Specifying the full path put the menu on for me:
$ sudo defaults write /Library/Preferences/com.apple.appstore ShowDebugMenu -bool true
…thanks!
I like this a great deal. Nice detective work, perfect use of ln
What if you don’t want the receipt? I want to install the software and have them sign the receipt with their apple id’s. For free applications.
Really nice and handy post. However I’m trying to deploy some apps, e.g. Pages 5.1, and once it’s installed, in the App Store it says that there’s an update available for Pages 5.1.
Is there a way to remove the App Store update checking for these applications? Pages doesn’t have the _MASReceipt folder.
This is good stuff, thanks. however this software I need to distribute is only 1.8 MB and downloads at lightening speed – who thought I’d ever complain about that, sheesh. When I click Install & immediately click Pause, the app is already completely downloaded. Guess I’ll have to seek out some crappy overloaded public wifi…
Thanks Rich for this! I was successfully able to download and grab the pkg installer, however, when I try to run it, after successful install, I get an error “Exited with code: 173.” Seems this is documented all over regarding the DRM built into the App Store (supposedly resolved – obviously not). Specifically, in this instance, the app is Sketch from bohemian coding. We have 20 licenses and I don’t want to install one at a time. I’m using Casper for deployment and all my machines are 10.8.5 or 10.9.4/5.
Strange. Under my Purchases history I see Lion Server, but no Mountain Lion Server or Mavericks Server.
If I click either of the two URLs from the previous page, I am taken to the product page(s), but I am prompted to purchase the apps – again.
gskibum,
I ran into the same thing in my testing. I decided to risk paying $20 again, so I hit the button. The next thing that popped up was a notification that I had purchased a previous version of the software and the update would be free.
At that point, Server.app downloaded and installed into the 10.8.5 VM I was using for testing and I was not charged any money. I had an identical experience in the 10.9.5 VM I was using to test Mavericks’ Server.app.
In both cases, I had not previously installed Server.app into the test VM, so I got a new install of Server.app.
I’ve written a shell script that searches for the folder and creates the hard link to any pkg and also creates a matching text file with details of the pkg.
I’m hoping to automate this process via a launchd “watch” process that watches the AppStores manifest.plist for changes and then kicks off a script.
I’d like to eventually have it wait until the size of the pkg is correct (downloaded) and then work on the pkg and flatten it/repackage it if needed.
It creates and saves to “/tmp/appstorerepkg” for now to be worked on so will be deleted upon reboot.
No need for sudo.
The script is located https://github.com/Macdeviant/MacAppStoreRedist
Please take a look, test and let me know how it goes.
I’ll add to it when I get time/requests/comments/support.
I hope it helps and grows.
Do you mind iif I quote a couple of your posts as long as I provide
credit and sources back too your blog? My website is in the exact
saame area of interest as yours and my users would certainly
benefit from some of the information you provide here.
Please let me knopw if this ok wirh you. Appreciate it!
Sure, that’s fine as long as attribution is included with your post.
Post 3 years ago and still just as useful. Just awesome.
as of the official 10.12.0 macOS Sierra release the App Store Debug menu can no longer be enabled via defaults write. The Debug menu was available in the public beta of macOS Sierra. However, the location of the download has not changed nor has the process. By using lsof during the download I was able to locate the .pkg being downloaded on the computer & link to it. something like “sudo find /private/var/folders -iname “*.pkg*” will probably easily locate the download.
sudo find /private/var/folders -regex ‘.*\.pkg.*’ -type f -mtime -1 -exec ln {} ~/Desktop/
sudo find /private/var/folders -regex ‘.*\.pkg.*’ -type f -mtime -1 -exec ln “{}” /Users/Shared/ \;
That way its not on ‘roots’ desktop…. “” round {} ‘just in case’ and you need \; to close the -exec
🙂
+1
Wonderful, still useful in 2019.. On Mojave use this command to open the App Store Download folder, “open $TMPDIR../C/com.apple.appstore/”.
Thanks for that one.
Still useful in 2020! On Catalina use ” open $TMPDIR../C/com.apple.appstoreagent/com.apple.appstore/”
Is there an updated process that works with macOS Big Sur?