Skip to content

Instantly share code, notes, and snippets.

@egeneralov
Last active June 25, 2019 05:50
Show Gist options
  • Save egeneralov/794d24edeaf55abc5005c4963df4d127 to your computer and use it in GitHub Desktop.
Save egeneralov/794d24edeaf55abc5005c4963df4d127 to your computer and use it in GitHub Desktop.
pkg your applications

pkg your applications

  • run install.sh
  • write contents from profile.sh to ~/.bash_profile
  • use like pkgapp /Applications/Apple\ Configurator\ 2.app
  • OR pkgapp Apple\ Configurator\ 2.app
  • OR pkgapp Apple\ Configurator\ 2
  • search dmg on your desktop
#!/bin/bash -xe
wget https://raw.githubusercontent.com/adobe/chromium/master/chrome/installer/mac/pkg-dmg
install pkg-dmg /usr/local/bin/pkg-dmg
rm pkg-dmg
pkgapp () {
cd /Applications/
NAME=$(echo "$1" | sed 's/\///g' | sed 's/.app//g' | sed 's/Applications//g')
TMP_DIR="/tmp/TMP_DIR_${NAME}"
mkdir -p "${TMP_DIR}"
mv "/Applications/${NAME}.app" "${TMP_DIR}"
pkg-dmg \
--verbosity 2 \
--volname "${NAME}" \
--source "${TMP_DIR}" \
--target "${HOME}/Desktop/${NAME}.dmg"
mv "${TMP_DIR}/${NAME}.app" "/Applications"
rm -rf "${TMP_DIR}"
cd -
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment