Created
April 10, 2020 18:19
-
-
Save talkingmoose/0cefc38d6b835167f5db95231e0050e9 to your computer and use it in GitHub Desktop.
Returns the installation date for an app installed uisng an Apple Installer package. In Terminal run /path/to/script /path/to/Bundle.app (drag the app into the window).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# in Terminal run /path/to/script /path/to/Bundle.app | |
installedApp=$1 | |
# get the app's bundle identifier | |
bundleID=$( /usr/bin/defaults read "$installedApp/Contents/Info.plist" CFBundleIdentifier ) | |
# get the installation epoch date for the bundle identifier | |
installEpoch=$( /usr/sbin/pkgutil --pkg-info="$bundleID" | /usr/bin/grep "install-time" | /usr/bin/awk '{ print $2 }' ) | |
# convert epoch date to user-readable date and return the result | |
echo Installed: $( /bin/date -j -f "%s" "$installEpoch" ) | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment