### mas help install Command Output Source: https://github.com/mas-cli/mas/wiki/Command-Arguments Displays the help information for the 'install' command, including its arguments and flags. ```shell $ mas help install Install from the Mac App Store (integer) app ID(s) to install --force force reinstall ``` -------------------------------- ### Build Installer Package Source: https://github.com/mas-cli/mas/wiki/Release-Process Run the build script to generate the .build/mas.pkg installer package. ```shell script/build_artifacts ``` -------------------------------- ### Zsh Script Setup Source: https://github.com/mas-cli/mas/blob/main/GEMINI.md Initializes Zsh scripts by sourcing a setup file relative to the script's location. This ensures consistent environment setup. ```zsh . "${0:A:h}/_setup_script" ``` -------------------------------- ### MAS CLI Help for Specific Command Source: https://github.com/mas-cli/mas/wiki/Commands-help Use `mas help ` to get detailed usage information for a specific command, including its arguments and options. This example shows help for the 'uninstall' command. ```bash $ mas help uninstall Uninstall app installed from the Mac App Store (integer) ID of app to uninstall --dry-run dry run ``` -------------------------------- ### Attempt to Uninstall Non-existent App Source: https://github.com/mas-cli/mas/wiki/Commands-uninstall If the specified app is not installed, the uninstall command will report that it is not installed, even when run with root privileges. ```bash $ sudo mas uninstall 883878097 Password: Error: Not installed ``` -------------------------------- ### List Installed Mac App Store Apps Source: https://github.com/mas-cli/mas/wiki/Commands-list Use this command to view a list of all applications currently installed on your system that were obtained from the Mac App Store. The output includes the application ID, name, and version number. ```bash $ mas list 883878097 Server (5.7.1) 904280696 Things3 (3.8) 549083868 Display Menu (2.2.3) 1333542190 1Password 7 (7.2.4) 430255202 Mactracker (7.7.7) 918858936 Airmail 3 (3.6.57) 1419224245 Canopy (1.1.0) 1384080005 Tweetbot (3.2) 675248567 Install OS X Mavericks (1.3.46) 1447415753 Quests (1.0.14) 924726344 Deliveries (3.1.1) 492615400 iRamDisk (3.6.12) 993487541 CARROT Weather (1.3.3) 1037126344 Apple Configurator 2 (2.8.2) Install macOS High Sierra (1364) 748212890 Memory Cleaner (2.4.5) 915041082 Install OS X Yosemite (1.6.43) 890031187 Marked 2 (2.5.30) 873245660 Spillo (2.0) 409201541 Pages (7.3) 1055511498 Day One (2.9.2) 803453959 Slack (3.3.7) 975937182 Fantastical 2 (2.5.7) 406056744 Evernote (7.8) 411643860 DaisyDisk (4.6.5) 1018109117 Install OS X El Capitan (1.7.50) 1090488118 Gemini 2 (2.5.4) 413857545 Divvy (1.5.1) 457622435 Yoink (3.5.2) 409203825 Numbers (5.3) 409183694 Keynote (8.3) Install macOS Mojave (14022) 927292435 iStat Mini (1.1) 1091189122 Bear (1.6.8) ``` -------------------------------- ### Get Git Revision Hash Source: https://github.com/mas-cli/mas/wiki/Release-Process Retrieve the specific git revision hash for a given tag. ```shell git rev-list -n 1 v1.8.1 ``` -------------------------------- ### Bootstrap mas CLI Source: https://github.com/mas-cli/mas/blob/main/GEMINI.md Run this script to bootstrap the mas CLI project. Ensure you are in the project's root directory. ```shell Scripts/bootstrap ``` -------------------------------- ### Open Default App Store Landing Page Source: https://github.com/mas-cli/mas/wiki/Commands-open Running the 'open' command without any arguments or with the 'appstore' placeholder opens the default landing page of the Mac App Store. ```bash $ mas open ``` ```bash $ mas open appstore ``` -------------------------------- ### Verify Version Script Source: https://github.com/mas-cli/mas/wiki/Release-Process Execute the version script to verify and update the project version, which also updates the Sources/MasKit/Package.swift file. ```shell script/version ``` -------------------------------- ### Build mas CLI (Release) Source: https://github.com/mas-cli/mas/blob/main/GEMINI.md Use this command to build a release version of the mas CLI. The empty string argument is a placeholder for potential build flags. ```shell Scripts/build '' -c release ``` -------------------------------- ### mas help uninstall Command Output Source: https://github.com/mas-cli/mas/wiki/Command-Arguments Displays the help information for the 'uninstall' command, including its arguments and flags. ```shell $ mas help uninstall Uninstall app installed from the Mac App Store (integer) ID of app to uninstall --dry-run dry run ``` -------------------------------- ### Uninstall App with Root Privileges Source: https://github.com/mas-cli/mas/wiki/Commands-uninstall To successfully uninstall an app, use `sudo` to run the command with root privileges. This will move the app to the trash. ```bash $ sudo mas uninstall 883878097 Password: ==> App moved to trash: /private/var/root/.Trash/Server.app ``` -------------------------------- ### mas-cli Development Commands Source: https://github.com/mas-cli/mas/blob/main/README.md Provides a table of common development actions and their corresponding commands for the mas-cli project. These scripts are used for building, setting up, running, and testing the CLI. ```bash Scripts/build ``` ```bash Scripts/setup_libexec ``` ```bash Scripts/mas ``` ```bash Scripts/test ``` -------------------------------- ### Generate Bottles for Custom Tap Source: https://github.com/mas-cli/mas/wiki/Release-Process Run the build script to generate bottle archives for the custom Homebrew tap. ```shell script/bottle ``` -------------------------------- ### MAS CLI Available Commands Source: https://github.com/mas-cli/mas/wiki/Commands-help Run MAS CLI with no arguments to see a list of all available commands and their brief descriptions. This is useful for understanding the CLI's capabilities. ```bash Available commands: account Prints the primary account Apple ID help Display general or command-specific help home Opens MAS Preview app page in a browser info Display app information from the Mac App Store install Install from the Mac App Store list Lists apps from the Mac App Store which are currently installed lucky Install the first result from the Mac App Store open Opens app page in AppStore.app outdated Lists pending updates from the Mac App Store reset Resets the Mac App Store search Search for apps from the Mac App Store signin Sign in to the Mac App Store signout Sign out of the Mac App Store uninstall Uninstall app installed from the Mac App Store upgrade Upgrade outdated apps from the Mac App Store vendor Opens vendor's app page in a browser version Print version number ``` -------------------------------- ### Package Project Source: https://github.com/mas-cli/mas/blob/main/AGENTS.md Creates a package of the project, typically for distribution. ```shell Scripts/package ``` -------------------------------- ### Open Specific App Page Source: https://github.com/mas-cli/mas/wiki/Commands-open Use the 'open' command followed by an app ID to open that app's page in the Mac App Store. ```bash $ mas open 497799835 ``` -------------------------------- ### Format Code Source: https://github.com/mas-cli/mas/blob/main/CONTRIBUTING.md Run the formatting script before committing to ensure code style consistency across the project. ```bash Scripts/format ``` -------------------------------- ### Search for Apps and Display Prices on Mac App Store Source: https://github.com/mas-cli/mas/wiki/Commands-search This command searches for applications on the Mac App Store and displays their prices. It includes the app ID, name, price, and version. ```bash $ mas search xcode --price 497799835 Xcode $ 0.00 (10.1) 1163893338 App School for Xcode and iOS 10 Development Free $ 0.00 (1.0) 1183412116 Swiftify for Xcode $ 0.00 (4.6) 1179007212 Code School for Xcode Free -Learn How to Make Apps $ 0.00 (1.1.3) 1083165894 Course for Xcode 7 Lite $ 0.00 (1.0) 1168397789 Alignment for Xcode $ 0.00 (1.1.2) 734258109 Watchdog for Xcode $ 4.99 (1.9) 1246672247 BlockComment for Xcode $ 0.00 (1.0.0) 665134234 Training for Xcode $ 6.99 (1.3) ... ``` -------------------------------- ### Enable Spotlight Indexing on All Volumes Source: https://github.com/mas-cli/mas/blob/main/README.md This command enables Spotlight indexing across all mounted volumes on the system. It requires administrator privileges. ```shell # All volumes: sudo mdutil -Eai on ``` -------------------------------- ### Clone the Repository Source: https://github.com/mas-cli/mas/blob/main/CONTRIBUTING.md Clone your forked repository to your local machine. Ensure you are cloning from your own GitHub username. ```bash git clone git@github.com:your-username/mas.git ``` -------------------------------- ### Search for Apps on Mac App Store Source: https://github.com/mas-cli/mas/wiki/Commands-search Use this command to search for applications on the Mac App Store by their name. It lists the app ID, name, and version. ```bash $ mas search xcode 497799835 Xcode (10.1) 1163893338 App School for Xcode and iOS 10 Development Free (1.0) 1183412116 Swiftify for Xcode (4.6) 1179007212 Code School for Xcode Free -Learn How to Make Apps (1.1.3) 1083165894 Course for Xcode 7 Lite (1.0) ... ``` -------------------------------- ### Build mas CLI (Debug) Source: https://github.com/mas-cli/mas/blob/main/GEMINI.md Execute this script to build the mas CLI in debug mode. This is typically used during development. ```shell Scripts/build ``` -------------------------------- ### Re-index All Apps in Spotlight Source: https://github.com/mas-cli/mas/blob/main/README.md This command re-indexes all applications on the system. It first determines the preferred volume for applications and then indexes apps on that volume and the main Applications directory. ```shell # 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\"} ``` -------------------------------- ### Untap and Reinstall Core Mas Source: https://github.com/mas-cli/mas/wiki/Release-Process Optional command to untap the custom tap and reinstall the core mas bottle. ```shell brew untap mas-cli/tap && brew install mas ``` -------------------------------- ### Avoid Inlining Single-Use Utility Functions Source: https://github.com/mas-cli/mas/blob/main/AGENTS.md Demonstrates the incorrect practice of inlining a utility function at multiple call sites, leading to verbosity and potential duplication bugs. Use a utility function for multi-use cases to maintain clean abstractions. ```swift // ❌ BAD: Inlining uppercasingFirst at multiple call sites action1.performing.prefix(1).uppercased() + action.performing.dropFirst() action2.performing.prefix(1).uppercased() + action.performing.dropFirst() // ✅ GOOD: Use the utility function action1.performing.uppercasingFirst action2.performing.uppercasingFirst ``` -------------------------------- ### Quick Lint mas CLI Source: https://github.com/mas-cli/mas/blob/main/GEMINI.md Run a quick lint check on the mas CLI codebase using the provided script. The '-AP' flag likely enables specific checks. ```shell Scripts/lint -AP ``` -------------------------------- ### Tap Custom Homebrew Tap Source: https://github.com/mas-cli/mas/wiki/Release-Process Tap the mas-cli custom Homebrew tap to manage its formula. ```shell brew tap mas-cli/tap ``` -------------------------------- ### Attempt to Uninstall Without Root Source: https://github.com/mas-cli/mas/wiki/Commands-uninstall Attempting to uninstall an app without root privileges will result in an error, indicating that root permission is required. The app will not be moved to the trash. ```bash $ mas uninstall 883878097 Warning: Apps installed from the Mac App Store require root permission to remove. Error: Unable to move app to trash. Error: Uninstall failed ``` -------------------------------- ### Fetch Git Tags Source: https://github.com/mas-cli/mas/wiki/Release-Process Fetch all tags from the remote repository to ensure local tags are up-to-date. ```shell git fetch --tags ``` -------------------------------- ### Uninstall App with Dry Run Source: https://github.com/mas-cli/mas/wiki/Commands-uninstall Use the --dry-run flag to see which app would be removed without actually uninstalling it. This is useful for verification. ```bash $ mas uninstall 883878097 --dry-run ==> Server /Applications/Server.app ==> (not removed, dry run) ``` -------------------------------- ### Re-index Individual App in Spotlight Source: https://github.com/mas-cli/mas/blob/main/README.md Use this command to manually re-index a specific application in Spotlight, useful if an app is not being found correctly. ```shell # Individual app (if the omitted apps are known). e.g., for Xcode: mdimport /Applications/Xcode.app ``` -------------------------------- ### Test mas CLI Source: https://github.com/mas-cli/mas/blob/main/GEMINI.md Execute the test suite for the mas CLI project. This script runs all defined tests to ensure functionality. ```shell Scripts/test ``` -------------------------------- ### Create a Topic Branch Source: https://github.com/mas-cli/mas/blob/main/CONTRIBUTING.md Create a new branch for your feature or fix, branching off the main branch. This keeps your changes organized and separate from the main development line. ```bash git checkout -b feature main ``` -------------------------------- ### Check App Spotlight Indexing Source: https://github.com/mas-cli/mas/blob/main/README.md Use this command to verify if a specific application is indexed by macOS Spotlight. It outputs the App Store Adam ID if indexed, and nothing otherwise. ```console ## General format: $ mdls -rn kMDItemAppStoreAdamID ## Outputs the ADAM ID if the app is indexed. ## Outputs nothing if the app is not indexed. ## Example: $ mdls -rn kMDItemAppStoreAdamID /Applications/Xcode.app 497799835 ``` -------------------------------- ### Format mas CLI Code Source: https://github.com/mas-cli/mas/blob/main/GEMINI.md Format the mas CLI codebase according to project standards. Run this command repeatedly until no changes are detected. ```shell Scripts/format ``` -------------------------------- ### Find App Path by ADAM ID Source: https://github.com/mas-cli/mas/blob/main/README.md This shell command searches for the path of an application using its App Store ADAM ID through the Spotlight service. ```shell mdfind 'kMDItemAppStoreAdamID = ' ``` -------------------------------- ### Full Lint mas CLI Source: https://github.com/mas-cli/mas/blob/main/GEMINI.md Perform a comprehensive lint check on the mas CLI project. This command ensures adherence to coding standards. ```shell Scripts/lint ``` -------------------------------- ### Lint Code Source: https://github.com/mas-cli/mas/blob/main/CONTRIBUTING.md Run the linting script to check for and fix code quality issues before committing. Address all reported violations. ```bash Scripts/lint ``` -------------------------------- ### Safe Remove Command Source: https://github.com/mas-cli/mas/blob/main/AGENTS.md Use the `trash` command instead of `rm` for removing files. This provides a safer way to delete files, often by moving them to a trash bin. ```zsh trash ``` -------------------------------- ### Calculate SHA256 Hash for Bottle Source: https://github.com/mas-cli/mas/wiki/Release-Process Calculate the SHA256 hash for the generated bottle archive, used to update the formula. ```shell shasum -a 256 .build/bottles/mas-*.bottle.tar.gz ``` -------------------------------- ### Safe Copy Command Source: https://github.com/mas-cli/mas/blob/main/AGENTS.md Prefer using `cp -c` over `cp` for copying files. This ensures that the copy operation is safe and potentially avoids unintended side effects. ```zsh cp -c ``` -------------------------------- ### Sign in to Mac App Store (Disabled) Source: https://github.com/mas-cli/mas/wiki/Commands-signin This command is disabled on macOS 10.13 High Sierra and later. It attempts to sign in with a provided Apple ID. An error message is displayed indicating the command's unavailability. ```bash $ mas signin not@your.com Error: The 'signin' command has been disabled on this macOS version. Please sign into the Mac App Store app manually. For more info see: https://github.com/mas-cli/mas/issues/164 ``` -------------------------------- ### Bump Homebrew Formula PR Source: https://github.com/mas-cli/mas/wiki/Release-Process Use this command to create a pull request to update the mas formula in Homebrew core after a GitHub release. ```shell brew bump-formula-pr mas --tag=v1.8.1 ``` -------------------------------- ### Avoid Replacing Abstractions with Verbose Closures Source: https://github.com/mas-cli/mas/blob/main/AGENTS.md Illustrates the negative impact of replacing a clear comparator abstraction with a verbose closure, especially when the abstraction is used multiple times. Retain custom comparators for readability and maintainability. ```swift // ❌ BAD: Replacing a clean comparator with verbose closure [6, 9, 3].sorted { $0.compare($1, options: .numeric) == .orderedAscending } [2, 8, 4].sorted { $0.compare($1, options: .numeric) == .orderedAscending } // ✅ GOOD: Keep the abstraction [6, 9, 3].sorted(using: NumericStringComparator.forward) [2, 8, 4].sorted(using: NumericStringComparator.forward) ``` -------------------------------- ### Update Custom Tap Formula Fields Source: https://github.com/mas-cli/mas/wiki/Release-Process Manually update the tag, revision, and root_url fields in the custom Homebrew tap formula for mas. ```shell tag: "v1.8.1", ``` ```shell revision: "23a36b4555f5625fe29915b31b8b101064452dca" ``` ```shell root_url "https://github.com/mas-cli/mas/releases/download/v1.8.1" ``` -------------------------------- ### Extracting ADAM ID from App Store URL Source: https://github.com/mas-cli/mas/blob/main/README.md Demonstrates how to extract an ADAM ID from an App Store URL. The ADAM ID is a numerical identifier for an app on the App Store. ```text https://apps.apple.com/us/app/xcode/id497799835?mt=12 ``` -------------------------------- ### Zsh Script Shebang Source: https://github.com/mas-cli/mas/blob/main/GEMINI.md Standard shebang line for Zsh scripts within the project. It includes flags for enhanced script behavior. ```zsh #!/bin/zsh -Ndefgku ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.