# mas — Mac App Store Apps from the Command Line

> Practical guide to mas: search, install, and update Mac App Store apps from the terminal — ideal for reproducible macOS setups alongside Homebrew.

Source: https://www.jpkc.com/db/en/cheatsheets/package-managers/mas/

<!-- PROSE:intro -->
mas is an unofficial command-line tool for the Mac App Store: it lets you search, install, and update App Store apps straight from the terminal, addressing each app by its numeric ID. That makes mas an ideal building block for reproducible macOS setups, for example alongside Homebrew in a provisioning script. Instead of clicking through each app by hand, you write them into a list once and install everything in a single run.
<!-- PROSE:intro:end -->

## Search & Info

`mas search '<query>'` — Search the Mac App Store.

```bash
mas search 'Xcode'
```

`mas info <app-id>` — Show detailed info about an app.

```bash
mas info 497799835
```

`mas home <app-id>` — Open the app's App Store page in a browser.

```bash
mas home 497799835
```

## Install & Purchase

`mas install <app-id>` — Install an app by its ID.

```bash
mas install 497799835
```

`mas install <id1> <id2> <id3>` — Install multiple apps at once.

```bash
mas install 497799835 409183694 1295203466
```

`mas purchase <app-id>` — Purchase and install a free app (adds to your account).

```bash
mas purchase 409183694
```

## Update

`mas outdated` — List all apps with available updates.

```bash
mas outdated
```

`mas upgrade` — Update all outdated apps.

```bash
mas upgrade
```

`mas upgrade <app-id>` — Update a specific app.

```bash
mas upgrade 497799835
```

## List & Account

`mas list` — List all installed App Store apps with their IDs.

```bash
mas list
```

`mas account` — Show the currently signed-in Apple ID.

```bash
mas account
```

`mas version` — Show the mas version.

```bash
mas version
```

## Common Patterns

`mas list | grep -i '<name>'` — Find the App ID of an installed app.

```bash
mas list | grep -i xcode
```

`mas search '<query>' | head -5` — Quick search showing top 5 results.

```bash
mas search 'text editor' | head -5
```

`mas install 497799835 && mas install 409183694` — Scripted install of multiple apps (e.g., Xcode + Keynote).

```bash
mas install 497799835 && mas install 409183694
```

`mas outdated | wc -l` — Count how many apps need updates.

```bash
mas outdated | wc -l
```

<!-- PROSE:outro -->
## Conclusion

mas closes the gap Homebrew leaves on macOS: apps available only through the Mac App Store can be scripted just like Homebrew formulae and casks. Keep one thing in mind: `mas install` reliably downloads only apps that have already been "purchased" or downloaded once with your Apple ID — new apps therefore need to be associated with your account in the App Store first. Signing in itself can no longer be done reliably from the command line on recent macOS versions (`mas signin` is restricted); if in doubt, sign in manually in the App Store app, after which `mas install` and `mas upgrade` work as expected. This lets you combine a reproducible Brewfile with a mas app list into a nearly fully automated machine setup.

## Further Reading

- [mas-cli – GitHub project](https://github.com/mas-cli/mas) – source code, releases, and installation via Homebrew
- [Mac App Store](https://www.apple.com/app-store/) – Apple's official App Store page
<!-- PROSE:outro:end -->

## Related Commands

- [brew](https://www.jpkc.com/db/en/cheatsheets/package-managers/brew/) – package manager for macOS and Linux (CLI tools and graphical apps as casks)
- [winget](https://www.jpkc.com/db/en/cheatsheets/package-managers/winget/) – Microsoft's Windows package manager
- [apt](https://www.jpkc.com/db/en/cheatsheets/package-managers/apt/) – manage packages on Debian and Ubuntu

