Skip to content

Instantly share code, notes, and snippets.

@teezyyoxo
Last active January 26, 2024 15:01
Show Gist options
  • Save teezyyoxo/47dd299643bd7037e362c5fa167136a0 to your computer and use it in GitHub Desktop.
Save teezyyoxo/47dd299643bd7037e362c5fa167136a0 to your computer and use it in GitHub Desktop.
Script to install homebrew + mas-cli binaries and execute mas-cli. This serves the purpose of resolving an issue where a federated Apple ID is signed in (automatically or otherwise) to the Mac App Store ("MAS") and macOS provides no way of signing out – usually this is manifest by the "Sign Out" button being greyed out or the Account Settings me…
#####/bin/bash
#!/usr/bin/bash
################################################################################
# mas brew por favor #
# #
# 6/7/2023 Montel G. #
# Original code. #NONINTERACTIVE=1 removed for testing. #
# Way less of a headache. #
# #
# #
# #
# #
################################################################################
################################################################################
################################################################################
# #
# Copyright (C) 2023, Montel G. #
# #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
################################################################################
################################################################################
################################################################################
#Script to install brew + mas binaries
#This serves the purpose of resolving an issue where a federated Apple ID is signed in (automatically or otherwise) to the Mac App Store ("MAS") and macOS provides no way of signing out – usually this is manifest by the "Sign Out" button being greyed out or the Account Settings menu being inaccessible.
#######TIME FOR BREW!!!!!#######
echo "Installing the 'brew' package manager for macOS now. Please pay attention to any prompts! Don't mind the wall of text that shows up :)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)";
echo "Please wait." && sleep 1
echo "Please wait.." && sleep 1
echo "Please wait..." && sleep 1
###Environment setup!###
eval "$(/opt/homebrew/bin/brew shellenv)"
echo "Shell environment now associated with brew binary."
brew install mas > /dev/null
echo "mas binary installed."
mas signout
###DONE###
echo "All set and signed out. You should now be able to sign in to the MAS with any account now. Re-run this script if you get stuck signed in again."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment