25

Is there an official way provided by Apple or a workaround so that I can install or update Mac App Store apps through Terminal?

  • Any chance one of the answers is selectable as "solving" your question? – bmike Feb 17 '16 at 0:21
18

Note: This will only work on machines with an OS prior to macOS 10.7

There is a commandline app called softwareupdate that you have to run as root.

sudo softwareupdate --list for example will give you the list of apps that are set to update. You can then run sudo softwareupdate --install {app-name}

This won't let you install a new application that you haven't already downloaded though.

  • 16
    The software update tool does not update Mac App Store apps on any OS from 10.7 through 10.9.2 - only system software updates are available from the command line. The author is correct that you can't instal new updates and incorrect that other third party app updates will be included to update. – bmike Nov 28 '12 at 17:42
  • 2
    This answer is not correct and should not be marked as such. The answer below about github.com/mas-cli/mas is the right one. – AdamG May 25 '17 at 19:46
23

Until recently, the answer was no but there are open source efforts to replicate the Mac App Store in a command-line based tool:

To install:

brew install mas 

Once it's in, you could update all the apps that are available with:

mas upgrade

If you don't like this tool, you could also use MDM tools to package an already downloaded application and distribute it internally. Examples are Casper Suite, sftp, rsync, etc... and side load these apps. You do need to use the GUI or the mas tool to get the first copy of the application, however. So, if you already have the app, you can file share it over, but you can't get the App updated or installed solely from the terminal.

In a nutshell - you would set up an MDM server (there are now open source options) like:

Then you would make your own App Store app that's amenable to command line updates. For that munki is a nice open-source choice:

From there you could package the app updates and server them side loaded or use the InstallApplication MDM command to trigger an app install or update. Do note, that if you are pulling the app or the update from Apple's servers - you still need the user to enter their Apple ID and password in the prompt that OS X provides for the update. This does bypass opening the App Store app so it's a partial win, I suppose.

At present, the command line can only list software updates that come through the App Store the same as the previous Software Update server was used to download system updates and updates to apps that came on physical media. Terminal is not able to update apps that were bought electronically through the Mac App Store. Only some Apple apps are included in the updates using the softwareupdate command.

Not the answer you're looking for? Browse other questions tagged .