Wednesday, October 4, 2017

Install Mac App Store Applications from the command line.

I recently, and hastily made some scripts for recovery of a mac, as I did a clean install of High Sierra (Which I don't recommend for right now, I have some problems with it, that I feel will easily be remedied as time passes. Mainly some issues with messages). But I found a handy location, called mac that let's you install Mac App Store Lications from the command Line. If we learned anything today, it's that Lication is the best way to shorten the word Application.


#Have the full Xcode installed for this to work
#Install mas
brew install mas
#Declare your lications, with line breaks in between
LICATIONS="Pages\nKeynote\nNumbers\nGarageBand\nKindle"
#for loop, looping through lications
for i in $(echo -e $LICATIONS)
        do
    #Install the lication, by finding and printing it's corresponding number, this is how mas works
        mas install $(mas search $i | ggrep -P  "^\d+ $i$" | awk '{print $1}') &
    # Note that I eneded this line, with an ampersand switching it to the background, as to install in Parallel
    #If you feel like it's doing to many at one time, remove the ampersand
        done
If you want to be this handy at bash, you can check out this book.

No comments: