mas is a command-line interface for the Mac App Store designed for scripting & automation.
| Provider | Method | mas | macOS |
|---|---|---|---|
| Homebrew Core | brew install mas |
14+ (recommended) | |
| Homebrew Tap | brew install mas-cli/tap/mas |
13+ | |
| MacPorts | sudo port install mas |
13+ | |
| GitHub Releases | Installers & source archives | All | Release-dependent |
Detailed documentation is available via man mas & mas --help.
| Command | Functionality | Notes | Aliases |
|---|---|---|---|
search <term>… |
Search for App Store apps | json | |
lookup <id>… |
Output App Store app details | json | info |
list [<id>…] |
Output installed apps | spotlight, json | |
outdated [<id>…] |
Output outdated apps | spotlight, json | |
outdated --accurate [<id>…] |
Output outdated apps | spotlight, account, json | |
get <id>… |
Get free apps, install any apps | spotlight, root, account | purchase |
install <id>… |
Install gotten or purchased apps | spotlight, root, account | |
lucky <term>… |
Install first matching app | spotlight, root, account | |
update [<id>…] |
Update outdated apps | spotlight, root, account | upgrade |
update --accurate [<id>…] |
Update outdated apps | spotlight, root, account | upgrade |
uninstall (<id>…|--all) |
Uninstall apps | spotlight, root | |
signout |
Sign out from App Store | ||
open [<id>] |
Open app App Store page | ||
home <id>… |
Open app web pages | ||
seller <id>… |
Open seller app web pages | vendor |
|
reset |
Reset App Store processes | ||
config |
Output config | json | |
version |
Output version |
| Tool | Functionality |
|---|---|
| Homebrew Bundle | Include installed apps in Brewfile; get, install & update Brewfile apps |
| Topgrade | Update apps |
| Issue | Solution |
|---|---|
| Manage system software (macOS, Safari…) | Use softwareupdate |
| App info inconsistencies | Wait hours – days (App Store uses eventual consistency) |
| Cannot purchase paid apps | Purchase paid apps directly in App Store; submit PR |
| iOS & iPadOS apps unsupported | Submit PR |
| Hangs | Index apps in Spotlight; open bug report if hangs persist |
| Undetected installed apps | Index apps in Spotlight |
This redownload is not available for this Apple Account… error |
Sign in correct Apple Account to App Store, or uninstall app & get it with current Apple Account |
| Other bugs | Subscribe to existing, or open new, bug report |
| Action | Command |
|---|---|
| Build | Scripts/build or Xcode 26+ |
| Set up zsh wrapper | Scripts/setup_libexec |
| Run zsh wrapper | Scripts/mas |
| Test (Swift Testing) | Scripts/test |
App Store apps each have 2 unique IDs:
| Type | Format | Example (for Xcode) |
|---|---|---|
| ADAM ID | Integer | 497799835 |
| Bundle ID | String | com.apple.dt.Xcode |
mas commands accept both types of app IDs as arguments.
By default, all-digit app IDs are considered ADAM IDs; other app IDs are considered bundle IDs.
--bundle forces all-digit app IDs to also be considered bundle IDs.
ADAM IDs can be found via:
mas search <term>…mas list- The App Store:
- Open an app's App Store page
- Open the page's Share Sheet
- Choose
Copy - Extract the ADAM ID from the URL in the copied text
- e.g.,
497799835from https://apps.apple.com/us/app/xcode/id497799835?mt=12
- e.g.,
list, outdated & search normally output tabular data, with a few fields
for each app on its own row.
lookup normally outputs fields as key-value pairs—one per line—in a contiguous
block for each app, with a blank line between apps.
If --json is supplied, these commands output a stream of JSON objects—one per
app—each containing all fields provided by Apple for that app.
Many of the JSON keys provided by Apple are poorly named, so they are mapped to better names by an algorithm.
Mapped JSON keys are sorted.
Each JSON key should be unique within an object; if duplicate keys exist in an object, their relative ordering in the input is preserved in the output.
If Apple renames or adds JSON keys, suboptimal JSON keys might be output until the mapping is updated.
config normally outputs settings as key-value pairs, one per line.
If --json is supplied, config outputs all settings in a single JSON object.
Since the JSON keys are defined by mas, they are guaranteed to be unique & correct.
list, outdated, get, install, lucky, update & uninstall obtain
data for installed apps from the Spotlight Metadata Service (MDS).
Spotlight indexing thus must be enabled & valid for folders containing App Store apps.
Check if an app is properly indexed in Spotlight via:
## General format:
$ mdls -rn kMDItemAppStoreAdamID <path-to-app>
## Outputs the ADAM ID if the app is indexed
## Outputs nothing if the app is not indexed
## Example:
$ mdls -rn kMDItemAppStoreAdamID /Applications/Xcode.app
497799835If an app is indexed in Spotlight, find the path to the app from its ADAM ID via:
mdfind 'kMDItemAppStoreAdamID = <adam-id>'If any App Store apps are not properly indexed, index via:
# Individual app (if the omitted apps are known). e.g., for Xcode:
mdimport /Applications/Xcode.app
# All apps:
vol="$(/usr/libexec/PlistBuddy -c "Print :PreferredVolume:name" ~/Library/Preferences/com.apple.appstored.plist 2>/dev/null)"
mdimport /Applications ${vol:+"/Volumes/${vol}/Applications"}
# All volumes:
sudo mdutil -Eai onget, install, lucky, update & uninstall require root privileges.
If run without root privileges, mas requests them as necessary.
mas uses existing valid sudo credentials, falling back to prompting for the macOS user password, which is piped directly to a sudo process; the password is never visible to, nor stored by, mas.
Any sudo credentials used or established by mas remain valid after mas finishes, pursuant to the user-configured sudo timeout.
get, install, lucky, update & outdated --accurate require an Apple
Account signed in to the App Store.
get requires an Apple Account signed in to the App Store.
Even when an Apple Account is already signed in to the App Store, the system security settings might require authenticating the Apple Account for each app being gotten.
If System Settings > Touch ID & Password > Use Touch ID for purchases in iTunes Store, App Store and Apple Books is:
Enabled: You must authenticate (via Touch ID or Apple Account password) for each app being gotten.Disabled: IfSystem Settings>Apple Account>Media & Purchases>Free Downloadsis:Always Require: You must authenticate (via Apple Account password) for each app being gotten.Never Require: Apps are gotten without additional authentication.
Note: App Store authentication is separate from any macOS user authentication required to grant root privileges to get apps.
Licensed under the MIT license.
Originally created by Andrew Naylor (@argon on GitHub | @argon on X).
