mas CLI: Manage macOS App Store Apps from the Terminal

mas CLI – The Mac App Store Command‑Line Interface

macOS ships with a robust GUI for the App Store, but for many developers, sysadmins and power users a terminal‑based solution can be far more efficient. mas (pronounced mass) is a lightweight, open‑source command‑line tool written in Swift that lets you search, install, update and manage applications directly from the shell.

Repository link: https://github.com/mas-cli/mas

Table of Contents

Why mas?

  • Automation Ready – Scripts and cron jobs can easily install and update apps without user interaction.
  • Cross‑Platform – Works on macOS 13 Ventura and newer; older macOS versions are supported through a Homebrew tap.
  • Root‑Safe – Uses sudo internally to handle installation restrictions and recent Apple security changes.
  • Open Source – 12k+ GitHub stars and an active community mean frequent updates, bug fixes, and feature proposals.

Requirements

  • macOS 13 Ventura or later (for full binary support). The source can be built on older macOS versions.
  • Swift 6.2 (used by the Xcode project).
  • Homebrew or MacPorts for easy installation.

Installation

brew install mas

MacPorts

sudo port install mas

Older macOS (10.11 – 12) via Homebrew Tap

brew install mas-cli/tap/mas

From GitHub Releases

Download the latest binary for your architecture from the Releases page and place it into /usr/local/bin or use brew install --build-from-source.

Getting Started

Search and Lookup

mas accepts app IDs in two forms: * Adam ID – numeric (e.g., 497799835 for Xcode). * Bundle ID – text (e.g., com.apple.Xcode).

# Search for an app by name
mas search Xcode
# Results:
# 497799835 Xcode
# 688199928 Docs for Xcode
# ...

# Get detailed info
mas lookup 497799835
# Output:
# Xcode 26.1.1 [Free]
# By: Apple Inc.
# Released: 2025-11-11
# Minimum OS: 15.6
# Size: 2,913.8 MB

Tip – Use --price with search to see app prices.

Listing Installed Apps

mas list
# Output example:
# 497799835 Xcode (15.4)
# 640199958 Developer (10.6.5)
# 899247664 TestFlight (3.5.2)

Updating Apps

# Show which apps are outdated
mas outdated
# Output:
# 497799835 Xcode (15.4 -> 16.0)
# 640199958 Developer (10.6.5 -> 10.6.6)

# Update everything
sudo mas update
# Or update a specific app
sudo mas update 715768417

Installing New Apps

# Install a free app you haven’t got before
sudo mas get 497799835

# Install a previously purchased app
sudo mas install 497799835

# Quick installer for the first search result
sudo mas lucky Xcode

Remember – mas requires sudo for all install/update actions on macOS 13+ because Apple enforced installd root‑only security.

Root Privileges & Security

Starting with mas 4.0.0 all commands that modify the App Store data (install & update) automatically request sudo if not run as root. The tool does not store or expose your password; it forwards it securely to the sudo subprocess.

Why Root Is Required

Apple’s installd service is root‑only on recent macOS releases, making it mandatory for any application installer, including the App Store. mas abstracts this so you can simply run:

mas get 497799835
and receive an interactive password prompt.

Advanced Features

Homebrew Bundle Integration

If you already use brew bundle, mas can inject your installed App Store apps into your Brewfile:

brew bundle dump
# After updating, run `brew bundle` again to re‑apply installations.

Topgrade Compatibility

mas is fully supported by Topgrade. Running topgrade will automatically update any outdated App Store apps.

Spotlight Indexing Tips

mas reads installed‑app data from macOS’s Spotlight Metadata Service (MDS). If an app isn’t listed, re‑indexing might help:

mdimport /Applications/WhatsApp.app
# Or rebuild the whole database
sudo mdutil -Eai on

Troubleshooting

Symptom Likely Cause Fix
mas get fails with redownload not available App not purchased or refunded Buy the app via the App Store GUI first.
mas update shows no updates App Store service delay or local index stale Wait a few minutes or reindex Spotlight.
Commands crash in tmux tmux lacks pasteboard permissions Install reattach-to-user-namespace and wrap: reattach-to-user-namespace mas install 497799835.

If problems persist, run mas reset, try again, and file an issue on GitHub.

Contributing & Building Locally

# Clone the repo
git clone https://github.com/mas-cli/mas.git
cd mas

# Install dependencies (Xcode + Swift toolchain)
swift package update

# Build
swift build -c release

# Run tests
swift test

All changes are welcome. Follow the contribution guidelines.

License

mas is distributed under the MIT license.

Conclusion

mas turns macOS App Store management into a script‑friendly, repeatable workflow. Whether you’re a solo developer automating your workspace or a sysadmin provisioning a fleet of Macs, the command line eliminates the drag‑and‑drop steps of the GUI and integrates cleanly with existing tools like Homebrew, Topgrade, and your custom scripts. Try it today and bring your App Store to the command line!

Original Article: View Original

Share this article