commit eaaf79b7dc116de9ef2a0a12bb9372af6e8290e1 Author: Michael Marquez Date: Sun Jun 11 19:05:47 2023 -0400 First Commit diff --git a/mac_os_setup.sh b/mac_os_setup.sh new file mode 100644 index 0000000..9ec93e6 --- /dev/null +++ b/mac_os_setup.sh @@ -0,0 +1,117 @@ +function exists() { + command -v "$1" >/dev/null 2>&1 +} + +function install_brew () { + if exists brew + then + echo "Brew already installed..." + else + echo "Installing Brew..." + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/michaelmarquez/.zprofile + eval "$(/opt/homebrew/bin/brew shellenv)" + fi +} + +function install_visual_studio_code () { + if exists code + then + echo "Visual Studio Code already installed..." + else + echo "Installing Visual Studio Code..." + brew install --cask visual-studio-code + fi +} + +function install_iterm2 () { + if [ $(mdfind "kMDItemCFBundleIdentifier == com.googlecode.iterm2" /Applications/iTerm.app) ] + then + echo "Iterm2 already installed..." + else + echo "Installing Iterm2..." + brew install --cask iterm2 + fi +} + +function install_powerline_fonts () { + git clone https://github.com/powerline/fonts.git --depth=1 + cd fonts + ./install.sh + cd .. + rm -rf fonts +} + +# TODO: Use AWK to overwrite the ZSH_THEME +function install_ohmyzsh () { + if [ -d $HOME/.oh-my-zsh ] + then + echo "Ohmyzsh already installed..." + else + echo "Installing Ohmyzsh..." + sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" + echo >> ~/.zshrc + echo "# Remove Host Text from Terminal" >> ~/.zshrc + echo "prompt_context() {}" >> ~/.zshrc + sed 's/^ZSH_THEME="robbyrusell"/ZSH_THEME="agnoster"/' ~/.zshrc + install_powerline_fonts + fi +} + +function install_hackfont () { + if [[ $(ls ~/Library/Fonts/ | grep -i "hack") ]] + then + echo "Hack Font Already Installed..." + else + echo "Installing Hack Font..." + brew tap homebrew/cask-fonts + brew install --cask font-hack-nerd-font + fi +} + +function install_docker () { + if exists docker + then + echo "Docker already installed..." + else + echo "Installing Docker..." + brew install --cask docker + fi +} + +function install_1password() { + if [[ $(find /Applications -name "1Password.app" | grep .) ]] + then + echo "1Password already installed..." + else + echo "Installing 1Password..." + brew install --cask 1password + fi +} + +function install_brave() { + if [[ $(find /Applications -name "Brave Browser.app" | grep .) ]] + then + echo "Brave already installed..." + else + echo "Installing Brave..." + brew install --cask brave-browser + fi +} + +############################# +# MAIN # +############################# + +echo "===========================================================" +echo " STARTING APP INSTALLATION" +echo "===========================================================" + +install_brew +install_visual_studio_code +install_iterm2 +install_ohmyzsh +install_hackfont +install_docker +install_1password +install_brave \ No newline at end of file