Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
(OS X) Save Mac App Store downloads as .pkgs
#!/bin/bash
# Jacob Salmela
# 2014-06-01
#-------DESCRIPTION-----------
# smasp - Save Mac App Store Packages
#---------USAGE---------------
# Pause each app or update that you want to save a package for
# Run this script
#-------VARIABLES-------------
appStoreFolder=$(sudo find /private/var/folders -type f -name "*.pkg")
# For loop incrementor
i=0
#--------------------------------
#----------BEGIN SCRIPT----------
#--------------------------------
for package in $appStoreFolder
do
# Make a hard link of the package in the Downloads folder
sudo ln $package ~/Downloads/_MAS_$i.pkg
# Increment by one in case there are more .pkgs to save
i=$(($i+1))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment