Last active
January 23, 2023 13:39
-
-
Save jindalAnuj/dda4968789bf3cefa1f93cde8fe7eb76 to your computer and use it in GitHub Desktop.
Download brew and setup all applications on mac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# File to save the list of applications | |
app_list="./installed_apps.txt" | |
# Create file to save the list of applications | |
touch $app_list | |
# Extract the list of applications | |
ls /Applications > $app_list | |
# Print the list of applications | |
echo "The following applications are currently installed on your old Mac:" | |
cat $app_list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if Xcode Command Line Tools are already installed | |
if ! xcode-select -p > /dev/null; then | |
echo "Xcode Command Line Tools are not installed. Installing..." | |
# Install Xcode Command Line Tools | |
xcode-select --install | |
else | |
echo "Xcode Command Line Tools are already installed." | |
fi | |
# Check if Homebrew is installed | |
if ! command -v brew > /dev/null; then | |
echo "Homebrew is not installed. Installing..." | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" | |
fi | |
# Check if Git is already installed | |
if ! command -v git > /dev/null; then | |
echo "Git is not installed. Installing..." | |
# Install Git using Homebrew | |
brew install git | |
else | |
echo "Git is already installed." | |
fi | |
# Create an array of the applications to be downloaded | |
apps=( | |
"Google Chrome" | |
"Visual Studio Code" | |
"Slack" | |
"Spotify" | |
"iTerm2" | |
) | |
# Initialize variable to track user response | |
response="" | |
# Iterate through the array and download each application | |
for app in "${apps[@]}" | |
do | |
# Check if user has already given a response to skip or say yes to all | |
if [ "$response" = "s" ] || [ "$response" = "y" ]; then | |
echo "Downloading $app..." | |
brew cask install "$app" | |
elif [ "$response" = "n" ]; then | |
echo "Skipping $app..." | |
else | |
# Prompt user for confirmation before downloading | |
read -p "Download $app? (y/n/s/yall/nall) " response | |
# Check user response and download or skip application | |
if [ "$response" = "y" ]; then | |
echo "Downloading $app..." | |
brew cask install "$app" | |
elif [ "$response" = "s" ]; then | |
echo "Skipping $app..." | |
elif [ "$response" = "yall" ]; then | |
echo "Downloading all the remaining apps" | |
response="y" | |
elif [ "$response" = "nall" ]; then | |
echo "Skipping all the remaining apps" | |
response="n" | |
else | |
echo "Skipping $app..." | |
fi | |
fi | |
done | |
echo "All applications have been downloaded." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment