Apple doesn't supply a command line helper or any scriptable cocoa classes you can latch on to for automation. Unlike the overall software update, which allows updates and installs out of the box, you can script the process of clicking buttons with a mouse using Automator.
However, the app store has been reverse engineered and released open source as well as a binary form:
The install is quick and it appears to be quite reliable on the current version of OS X 10.11:
brew install argon/mas/mas
With the source released, I would expect some other implementations of this tool to pop up, perhaps even one scripted with python.
If someone is logged into the mac (windowmanager is running), you can use Automator and the "watch me do" function to automate updates and storing your store password in the script fairly insecurely.
Here are two tutorials to get you started if this meets your needs.
http://www.tuaw.com/2009/01/19/mac-automation-creating-watch-me-do-workflows/
http://automator.us/leopard/features/virtual-user.html
Once you have a working script, you can use the command line open
command to kick it off.
If the App Store app ever exposes that function to scripting you will have more options from the command line. It would be easy to use sdef
, sdp
and gen_bridge_metadata
to dump the entire scriptable dictionary and script things using ruby from the command line, but at present the best option would be to use the mas
command line tool.
The SetFile utility is provided with Xcode, which Apple distributes at no cost. Once you have installed Xcode, you can issue the command
SetFile -a T /path/to/foo.bar
Best Answer
I don't think you can do this with a shell command, but you can use a shell script to run AppleScript, which can do it. See here:
https://stackoverflow.com/questions/24421803/open-info-window-in-finder-by-applescript
https://stackoverflow.com/questions/37231942/open-get-information-window-in-finder-by-applescript-again
For example:
If you want to add in your bash or zsh profile: