Skip to content

Instantly share code, notes, and snippets.

@shivashishrs
Forked from vraravam/fresh-install-of-osx.sh
Created December 28, 2023 09:58
Show Gist options
  • Save shivashishrs/a161bd2082fb15d9bfbc138e88a089f6 to your computer and use it in GitHub Desktop.
Save shivashishrs/a161bd2082fb15d9bfbc138e88a089f6 to your computer and use it in GitHub Desktop.

Revisions

  1. @vraravam vraravam revised this gist Nov 19, 2023. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -171,6 +171,7 @@ setup_login_item() {
    test -d "/Applications/$1" && echo "Setting up $1 as a login item" && osascript -e "tell application \"System Events\" to make login item at end with properties {path:\"/Applications/$1\", hidden:false}" 2>&1 > /dev/null
    }

    setup_login_item "AlDente.app"
    setup_login_item "Clocker.app"
    setup_login_item "Cloudflare WARP.app"
    setup_login_item "Command X.app"
  2. @vraravam vraravam revised this gist Oct 13, 2023. No changes.
  3. @vraravam vraravam revised this gist Oct 13, 2023. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -79,6 +79,10 @@ override_prompt() {
    fi
    }

    command_exists() {
    type $1 &> /dev/null 2>&1
    }

    ######################
    # vim configurations #
    ######################
    @@ -131,7 +135,7 @@ sudo chown -fR "${USERNAME}":admin "${HOMEBREW_PREFIX}"
    #######################################
    # Install homebrew (on empty machine) #
    #######################################
    type brew > /dev/null || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
    command_exists brew || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

    override_prompt https://gist.github.com/vraravam/8c9eae91a3750bed86b81e3a4711f842/raw "${HOME}/Brewfile"
    brew bundle check || brew bundle --all || true
  4. @vraravam vraravam revised this gist Sep 18, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -144,7 +144,7 @@ replace_executable_if_exists_and_is_not_symlinked() {
    }

    # if we are using 'code-insiders' only, symlink it to 'code' for ease of typing
    replace_executable_if_exists_and_is_not_symlinked "${HOMEBREW_PREFIX}/bin/code-insiders" "${HOMEBREW_PREFIX}/bin/code"
    # replace_executable_if_exists_and_is_not_symlinked "${HOMEBREW_PREFIX}/bin/code-insiders" "${HOMEBREW_PREFIX}/bin/code"
    # Manual: Open VS Code and turn on syncing of the preferences data
    # if we are using 'vscodium-insiders' only, symlink it to 'codium' for ease of typing
    replace_executable_if_exists_and_is_not_symlinked "${HOMEBREW_PREFIX}/bin/codium-insiders" "${HOMEBREW_PREFIX}/bin/codium"
  5. @vraravam vraravam revised this gist Aug 1, 2023. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -52,6 +52,18 @@ sudo chmod -R 600 "${HOME}"/.ssh/*
    # sudo spectl --master-disable

    # utility functions
    green() {
    printf "\033[1;32m$1\033[0m"
    }

    red() {
    printf "\033[31m$1\033[0m"
    }

    yellow() {
    printf "\033[33m$1\033[0m"
    }

    override_prompt() {
    printf "$(green 'Downloading') "$2" : "
    if [ ! -f "$2" ]; then
  6. @vraravam vraravam revised this gist Jul 29, 2023. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -51,9 +51,6 @@ sudo chmod -R 600 "${HOME}"/.ssh/*
    ############################
    # sudo spectl --master-disable

    override_prompt https://gist.github.com/vraravam/ce0dda29bb07f0504df8686cfd2755ca/raw "${HOME}/.aliases"
    source "${HOME}/.aliases"

    # utility functions
    override_prompt() {
    printf "$(green 'Downloading') "$2" : "
    @@ -91,10 +88,12 @@ override_prompt https://gist.github.com/vraravam/51e0516f5d7c6beec676
    override_prompt https://gist.github.com/vraravam/ce8654afd65def117dc17e2b0a30156c/raw "${HOME}/.zprofile"
    override_prompt https://gist.github.com/vraravam/657c3b94d1b04bacd2b6a38c22d6ec56/raw "${HOME}/.zshrc"
    override_prompt https://gist.github.com/vraravam/9c8d9f335159f90c3fff890bcf3856d6/raw "${HOME}/.zshrc.custom"
    override_prompt https://gist.github.com/vraravam/ce0dda29bb07f0504df8686cfd2755ca/raw "${HOME}/.aliases"
    override_prompt https://gist.github.com/vraravam/93077cb859cdb64793cc500791da6dce/raw "${HOME}/.p10k.zsh"

    override_prompt https://gist.github.com/vraravam/d8c0a88d0046225e5700f6ba7258da65/raw "${HOME}/.gitignore"
    override_prompt https://gist.github.com/vraravam/eab090e70a545934f409/raw "${HOME}/.gitconfig"
    override_prompt https://gist.github.com/vraravam/e9676759db46950e1fd817e49e513394/raw "${HOME}/.gitconfig-template.inc"

    ##################################
    # Install custom plugins for zsh #
    @@ -169,6 +168,7 @@ setup_login_item "Stats.app"

    echo "********** Finished auto installation process: MANUALLY QUIT AND RESTART iTerm2 and Terminal apps **********"
    echo "1. Please ensure to edit the ${HOME}/.gitconfig* files to have your name and email configured instead of mine"
    echo "2. Go to Terminal > Preferences > Profiles > Basic > Text > Change Font to 'MesloLGS Nerd Font'"
    echo "3. Go to iTerm2 > Preferences > Profiles > Default > Text > Change Font to 'MesloLGS Nerd Font'"
    echo "4. Go to iTerm2 > Preferences > Profiles > Default > Keys > Key Mappings > Presets (and choose 'Natural Text Editing')"
    echo "2. Use ${HOME}/.gitconfig-template.inc as a template to create equivalent configuration files with your logins"
    echo "3. Go to Terminal > Preferences > Profiles > Basic > Text > Change Font to 'MesloLGS Nerd Font'"
    echo "4. Go to iTerm2 > Preferences > Profiles > Default > Text > Change Font to 'MesloLGS Nerd Font'"
    echo "5. Go to iTerm2 > Preferences > Profiles > Default > Keys > Key Mappings > Presets (and choose 'Natural Text Editing')"
  7. @vraravam vraravam revised this gist Jul 28, 2023. 1 changed file with 3 additions and 13 deletions.
    16 changes: 3 additions & 13 deletions fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -51,19 +51,10 @@ sudo chmod -R 600 "${HOME}"/.ssh/*
    ############################
    # sudo spectl --master-disable

    # utility functions
    green() {
    printf "\033[1;32m$1\033[0m"
    }

    red() {
    printf "\033[31m$1\033[0m"
    }

    yellow() {
    printf "\033[33m$1\033[0m"
    }
    override_prompt https://gist.github.com/vraravam/ce0dda29bb07f0504df8686cfd2755ca/raw "${HOME}/.aliases"
    source "${HOME}/.aliases"

    # utility functions
    override_prompt() {
    printf "$(green 'Downloading') "$2" : "
    if [ ! -f "$2" ]; then
    @@ -100,7 +91,6 @@ override_prompt https://gist.github.com/vraravam/51e0516f5d7c6beec676
    override_prompt https://gist.github.com/vraravam/ce8654afd65def117dc17e2b0a30156c/raw "${HOME}/.zprofile"
    override_prompt https://gist.github.com/vraravam/657c3b94d1b04bacd2b6a38c22d6ec56/raw "${HOME}/.zshrc"
    override_prompt https://gist.github.com/vraravam/9c8d9f335159f90c3fff890bcf3856d6/raw "${HOME}/.zshrc.custom"
    override_prompt https://gist.github.com/vraravam/ce0dda29bb07f0504df8686cfd2755ca/raw "${HOME}/.aliases"
    override_prompt https://gist.github.com/vraravam/93077cb859cdb64793cc500791da6dce/raw "${HOME}/.p10k.zsh"

    override_prompt https://gist.github.com/vraravam/d8c0a88d0046225e5700f6ba7258da65/raw "${HOME}/.gitignore"
  8. @vraravam vraravam revised this gist Jul 28, 2023. 1 changed file with 13 additions and 0 deletions.
    13 changes: 13 additions & 0 deletions fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -51,6 +51,19 @@ sudo chmod -R 600 "${HOME}"/.ssh/*
    ############################
    # sudo spectl --master-disable

    # utility functions
    green() {
    printf "\033[1;32m$1\033[0m"
    }

    red() {
    printf "\033[31m$1\033[0m"
    }

    yellow() {
    printf "\033[33m$1\033[0m"
    }

    override_prompt() {
    printf "$(green 'Downloading') "$2" : "
    if [ ! -f "$2" ]; then
  9. @vraravam vraravam revised this gist Jul 28, 2023. 1 changed file with 0 additions and 12 deletions.
    12 changes: 0 additions & 12 deletions fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -51,18 +51,6 @@ sudo chmod -R 600 "${HOME}"/.ssh/*
    ############################
    # sudo spectl --master-disable

    green() {
    printf "\033[1;32m$1\033[0m"
    }

    red() {
    printf "\033[31m$1\033[0m"
    }

    yellow() {
    printf "\033[33m$1\033[0m"
    }

    override_prompt() {
    printf "$(green 'Downloading') "$2" : "
    if [ ! -f "$2" ]; then
  10. @vraravam vraravam revised this gist Jul 27, 2023. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -166,14 +166,15 @@ setup_login_item() {
    }

    setup_login_item "Clocker.app"
    setup_login_item "Cloudflare WARP.app"
    setup_login_item "Command X.app"
    setup_login_item "Flycut.app"
    setup_login_item "iBar.app"
    setup_login_item "Itsycal.app"
    setup_login_item "KeepingYouAwake.app"
    setup_login_item "Keybase.app"
    setup_login_item "Rectangle.app"
    setup_login_item "Stats.app"
    setup_login_item "Command X.app"

    echo "********** Finished auto installation process: MANUALLY QUIT AND RESTART iTerm2 and Terminal apps **********"
    echo "1. Please ensure to edit the ${HOME}/.gitconfig* files to have your name and email configured instead of mine"
  11. @vraravam vraravam revised this gist Jul 19, 2023. No changes.
  12. @vraravam vraravam revised this gist Jul 19, 2023. 1 changed file with 27 additions and 27 deletions.
    54 changes: 27 additions & 27 deletions fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@
    # You can run this script using this command:
    # curl -L https://gist.github.com/vraravam/04fc2296b25090ea848642afbce4d168/raw -o fresh-install.sh; chmod +x ./fresh-install.sh; ./fresh-install.sh

    USERNAME=${USERNAME:-`whoami`}
    USERNAME=${USERNAME:-$(whoami)}

    ##################################
    # Install command line dev tools #
    @@ -43,8 +43,8 @@ fi
    #################################
    # Setup ssh scripts/directories #
    #################################
    mkdir -p ${HOME}/.ssh
    sudo chmod -R 600 ${HOME}/.ssh/*
    mkdir -p "${HOME}/.ssh"
    sudo chmod -R 600 "${HOME}"/.ssh/*

    ############################
    # Disable macos gatekeeper #
    @@ -63,16 +63,16 @@ yellow() {
    printf "\033[33m$1\033[0m"
    }

    override-prompt() {
    printf "$(green 'Downloading') $2 : "
    if [ ! -f $2 ]; then
    override_prompt() {
    printf "$(green 'Downloading') "$2" : "
    if [ ! -f "$2" ]; then
    echo "" # Dummy echo for new line
    curl -L $1 -o $2
    curl -L "$1" -o "$2"
    else
    printf "$(red 'already present'). Should I override [yn]? "
    read yn
    case $yn in
    [Yy]*) curl -L $1 -o $2 ;;
    [Yy]*) curl -L "$1" -o "$2" ;;
    [Nn]*) echo "$(yellow 'skipping')";;
    esac
    fi
    @@ -81,7 +81,7 @@ override-prompt() {
    ######################
    # vim configurations #
    ######################
    override-prompt https://gist.github.com/vraravam/2d8654cb21bfe506a64a05a49268d9de/raw ${HOME}/.vimrc
    override_prompt https://gist.github.com/vraravam/2d8654cb21bfe506a64a05a49268d9de/raw "${HOME}/.vimrc"

    ######################################################################################
    # Setup any sudo access password from cmd-line to also invoke the gui touchId prompt #
    @@ -92,46 +92,46 @@ curl -L https://gist.github.com/vraravam/0579373b2028e9b5b08ae87fb39c
    # Install oh-my-zsh #
    #####################
    export ZSH=
    [ ! -d ${HOME}/.oh-my-zsh ] && curl -L http://install.ohmyz.sh | sh
    [ ! -d "${HOME}/.oh-my-zsh" ] && curl -L http://install.ohmyz.sh | sh

    override-prompt https://gist.github.com/vraravam/a64d51fff250271aa7669438db5bd6a5/raw ${HOME}/.zshenv
    override-prompt https://gist.github.com/vraravam/51e0516f5d7c6beec67668d1a31b7da8/raw ${HOME}/.zlogin
    override-prompt https://gist.github.com/vraravam/ce8654afd65def117dc17e2b0a30156c/raw ${HOME}/.zprofile
    override-prompt https://gist.github.com/vraravam/657c3b94d1b04bacd2b6a38c22d6ec56/raw ${HOME}/.zshrc
    override-prompt https://gist.github.com/vraravam/9c8d9f335159f90c3fff890bcf3856d6/raw ${HOME}/.zshrc.custom
    override-prompt https://gist.github.com/vraravam/ce0dda29bb07f0504df8686cfd2755ca/raw ${HOME}/.aliases
    override-prompt https://gist.github.com/vraravam/93077cb859cdb64793cc500791da6dce/raw ${HOME}/.p10k.zsh
    override_prompt https://gist.github.com/vraravam/a64d51fff250271aa7669438db5bd6a5/raw "${HOME}/.zshenv"
    override_prompt https://gist.github.com/vraravam/51e0516f5d7c6beec67668d1a31b7da8/raw "${HOME}/.zlogin"
    override_prompt https://gist.github.com/vraravam/ce8654afd65def117dc17e2b0a30156c/raw "${HOME}/.zprofile"
    override_prompt https://gist.github.com/vraravam/657c3b94d1b04bacd2b6a38c22d6ec56/raw "${HOME}/.zshrc"
    override_prompt https://gist.github.com/vraravam/9c8d9f335159f90c3fff890bcf3856d6/raw "${HOME}/.zshrc.custom"
    override_prompt https://gist.github.com/vraravam/ce0dda29bb07f0504df8686cfd2755ca/raw "${HOME}/.aliases"
    override_prompt https://gist.github.com/vraravam/93077cb859cdb64793cc500791da6dce/raw "${HOME}/.p10k.zsh"

    override-prompt https://gist.github.com/vraravam/d8c0a88d0046225e5700f6ba7258da65/raw ${HOME}/.gitignore
    override-prompt https://gist.github.com/vraravam/eab090e70a545934f409/raw ${HOME}/.gitconfig
    override_prompt https://gist.github.com/vraravam/d8c0a88d0046225e5700f6ba7258da65/raw "${HOME}/.gitignore"
    override_prompt https://gist.github.com/vraravam/eab090e70a545934f409/raw "${HOME}/.gitconfig"

    ##################################
    # Install custom plugins for zsh #
    ##################################
    ZSH_CUSTOM=${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}
    [ ! -d ${ZSH_CUSTOM}/plugins/evalcache ] && git clone --depth=1 https://github.com/mroth/evalcache ${ZSH_CUSTOM}/plugins/evalcache
    [ ! -d "${ZSH_CUSTOM}/plugins/evalcache" ] && git clone --depth=1 https://github.com/mroth/evalcache "${ZSH_CUSTOM}/plugins/evalcache"
    # Note: Do not move these into 'Brewfile' - since that breaks the linking for omz plugins location
    [ ! -d ${ZSH_CUSTOM}/plugins/zsh-syntax-highlighting ] && git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM}/plugins/zsh-syntax-highlighting
    [ ! -d ${ZSH_CUSTOM}/plugins/zsh-autosuggestions ] && git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM}/plugins/zsh-autosuggestions
    [ ! -d "${ZSH_CUSTOM}/plugins/zsh-syntax-highlighting" ] && git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting "${ZSH_CUSTOM}/plugins/zsh-syntax-highlighting"
    [ ! -d "${ZSH_CUSTOM}/plugins/zsh-autosuggestions" ] && git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions "${ZSH_CUSTOM}/plugins/zsh-autosuggestions"

    ################################
    # Prep for installing homebrew #
    ################################
    source ${HOME}/.zshenv
    source ${HOME}/.zprofile
    source "${HOME}/.zshenv"
    source "${HOME}/.zprofile"
    # TODO: Don't run this here - it fails (need to figure out how to fix it)
    # exec zsh

    sudo mkdir -p ${HOMEBREW_PREFIX}/tmp ${HOMEBREW_PREFIX}/repository ${HOMEBREW_PREFIX}/plugins ${HOMEBREW_PREFIX}/bin
    sudo chown -fR ${USERNAME}:admin ${HOMEBREW_PREFIX}
    sudo mkdir -p "${HOMEBREW_PREFIX}/tmp" "${HOMEBREW_PREFIX}/repository" "${HOMEBREW_PREFIX}/plugins" "${HOMEBREW_PREFIX}/bin"
    sudo chown -fR "${USERNAME}":admin "${HOMEBREW_PREFIX}"
    # sudo rm -rf ${HOME}/.gnupg # to delete gpg keys that might have been generated from an older version of gpg

    #######################################
    # Install homebrew (on empty machine) #
    #######################################
    type brew > /dev/null || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

    override-prompt https://gist.github.com/vraravam/8c9eae91a3750bed86b81e3a4711f842/raw ${HOME}/Brewfile
    override_prompt https://gist.github.com/vraravam/8c9eae91a3750bed86b81e3a4711f842/raw "${HOME}/Brewfile"
    brew bundle check || brew bundle --all || true

    ###########################################
  13. @vraravam vraravam revised this gist Jul 10, 2023. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -104,7 +104,6 @@ override-prompt https://gist.github.com/vraravam/93077cb859cdb64793cc

    override-prompt https://gist.github.com/vraravam/d8c0a88d0046225e5700f6ba7258da65/raw ${HOME}/.gitignore
    override-prompt https://gist.github.com/vraravam/eab090e70a545934f409/raw ${HOME}/.gitconfig
    override-prompt https://gist.github.com/vraravam/eb2161236d78fc0bda77/raw ${HOME}/.gemrc

    ##################################
    # Install custom plugins for zsh #
    @@ -178,6 +177,6 @@ setup_login_item "Command X.app"

    echo "********** Finished auto installation process: MANUALLY QUIT AND RESTART iTerm2 and Terminal apps **********"
    echo "1. Please ensure to edit the ${HOME}/.gitconfig* files to have your name and email configured instead of mine"
    echo "2. Go to iTerm2 > Preferences > Profiles > Default > Text > Change Font to 'MesloLGS Nerd Font'"
    echo "3. Go to Terminal > Preferences > Profiles > Basic > Text > Change Font to 'MesloLGS Nerd Font'"
    echo "2. Go to Terminal > Preferences > Profiles > Basic > Text > Change Font to 'MesloLGS Nerd Font'"
    echo "3. Go to iTerm2 > Preferences > Profiles > Default > Text > Change Font to 'MesloLGS Nerd Font'"
    echo "4. Go to iTerm2 > Preferences > Profiles > Default > Keys > Key Mappings > Presets (and choose 'Natural Text Editing')"
  14. @vraravam vraravam revised this gist Jul 6, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@
    # file location: <anywhere> (just need to invoke it from that location)

    # You can run this script using this command:
    # curl -L https://gist.github.com/vraravam/04fc2296b25090ea848642afbce4d168/raw | bash
    # curl -L https://gist.github.com/vraravam/04fc2296b25090ea848642afbce4d168/raw -o fresh-install.sh; chmod +x ./fresh-install.sh; ./fresh-install.sh

    USERNAME=${USERNAME:-`whoami`}

  15. @vraravam vraravam revised this gist Jul 5, 2023. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -51,19 +51,19 @@ sudo chmod -R 600 ${HOME}/.ssh/*
    ############################
    # sudo spectl --master-disable

    function green {
    green() {
    printf "\033[1;32m$1\033[0m"
    }

    function red {
    red() {
    printf "\033[31m$1\033[0m"
    }

    function yellow {
    yellow() {
    printf "\033[33m$1\033[0m"
    }

    function override-prompt {
    override-prompt() {
    printf "$(green 'Downloading') $2 : "
    if [ ! -f $2 ]; then
    echo "" # Dummy echo for new line
    @@ -165,6 +165,7 @@ ln -sf "${HOMEBREW_PREFIX}/bin/codium-insiders" "${HOMEBREW_PREFIX}/bin/code"
    setup_login_item() {
    test -d "/Applications/$1" && echo "Setting up $1 as a login item" && osascript -e "tell application \"System Events\" to make login item at end with properties {path:\"/Applications/$1\", hidden:false}" 2>&1 > /dev/null
    }

    setup_login_item "Clocker.app"
    setup_login_item "Flycut.app"
    setup_login_item "iBar.app"
  16. @vraravam vraravam revised this gist Jul 5, 2023. 1 changed file with 16 additions and 2 deletions.
    18 changes: 16 additions & 2 deletions fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -51,15 +51,29 @@ sudo chmod -R 600 ${HOME}/.ssh/*
    ############################
    # sudo spectl --master-disable

    function green {
    printf "\033[1;32m$1\033[0m"
    }

    function red {
    printf "\033[31m$1\033[0m"
    }

    function yellow {
    printf "\033[33m$1\033[0m"
    }

    function override-prompt {
    printf "$(green 'Downloading') $2 : "
    if [ ! -f $2 ]; then
    echo "" # Dummy echo for new line
    curl -L $1 -o $2
    else
    printf "$2 already present. Should I override [yn]? "
    printf "$(red 'already present'). Should I override [yn]? "
    read yn
    case $yn in
    [Yy]*) curl -L $1 -o $2 ;;
    [Nn]*) echo "skipping since $2 is already present";;
    [Nn]*) echo "$(yellow 'skipping')";;
    esac
    fi
    }
  17. @vraravam vraravam revised this gist Jul 5, 2023. 1 changed file with 27 additions and 13 deletions.
    40 changes: 27 additions & 13 deletions fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    #!/usr/bin/env bash

    # This script can be used to setup a macos machine based on Vijay's configurations. As of now, this script is now idempotent and will restore your local setup to the same state if run multiple times.
    # This script can be used to setup a macos machine based on Vijay's configurations. As of now, this script is idempotent and will restore your local setup to the same state if run multiple times.
    # If you have the same files already present, it will prompt you whether to override or not
    # file location: <anywhere> (just need to invoke it from that location)

    # You can run this script using this command:
    @@ -50,10 +51,23 @@ sudo chmod -R 600 ${HOME}/.ssh/*
    ############################
    # sudo spectl --master-disable

    function override-prompt {
    if [ ! -f $2 ]; then
    curl -L $1 -o $2
    else
    printf "$2 already present. Should I override [yn]? "
    read yn
    case $yn in
    [Yy]*) curl -L $1 -o $2 ;;
    [Nn]*) echo "skipping since $2 is already present";;
    esac
    fi
    }

    ######################
    # vim configurations #
    ######################
    curl -L https://gist.github.com/vraravam/2d8654cb21bfe506a64a05a49268d9de/raw -o ${HOME}/.vimrc
    override-prompt https://gist.github.com/vraravam/2d8654cb21bfe506a64a05a49268d9de/raw ${HOME}/.vimrc

    ######################################################################################
    # Setup any sudo access password from cmd-line to also invoke the gui touchId prompt #
    @@ -66,17 +80,17 @@ curl -L https://gist.github.com/vraravam/0579373b2028e9b5b08ae87fb39c
    export ZSH=
    [ ! -d ${HOME}/.oh-my-zsh ] && curl -L http://install.ohmyz.sh | sh

    curl -L https://gist.github.com/vraravam/a64d51fff250271aa7669438db5bd6a5/raw -o ${HOME}/.zshenv
    curl -L https://gist.github.com/vraravam/51e0516f5d7c6beec67668d1a31b7da8/raw -o ${HOME}/.zlogin
    curl -L https://gist.github.com/vraravam/ce8654afd65def117dc17e2b0a30156c/raw -o ${HOME}/.zprofile
    curl -L https://gist.github.com/vraravam/657c3b94d1b04bacd2b6a38c22d6ec56/raw -o ${HOME}/.zshrc
    curl -L https://gist.github.com/vraravam/9c8d9f335159f90c3fff890bcf3856d6/raw -o ${HOME}/.zshrc.custom
    curl -L https://gist.github.com/vraravam/ce0dda29bb07f0504df8686cfd2755ca/raw -o ${HOME}/.aliases
    curl -L https://gist.github.com/vraravam/93077cb859cdb64793cc500791da6dce/raw -o ${HOME}/.p10k.zsh
    override-prompt https://gist.github.com/vraravam/a64d51fff250271aa7669438db5bd6a5/raw ${HOME}/.zshenv
    override-prompt https://gist.github.com/vraravam/51e0516f5d7c6beec67668d1a31b7da8/raw ${HOME}/.zlogin
    override-prompt https://gist.github.com/vraravam/ce8654afd65def117dc17e2b0a30156c/raw ${HOME}/.zprofile
    override-prompt https://gist.github.com/vraravam/657c3b94d1b04bacd2b6a38c22d6ec56/raw ${HOME}/.zshrc
    override-prompt https://gist.github.com/vraravam/9c8d9f335159f90c3fff890bcf3856d6/raw ${HOME}/.zshrc.custom
    override-prompt https://gist.github.com/vraravam/ce0dda29bb07f0504df8686cfd2755ca/raw ${HOME}/.aliases
    override-prompt https://gist.github.com/vraravam/93077cb859cdb64793cc500791da6dce/raw ${HOME}/.p10k.zsh

    curl -L https://gist.github.com/vraravam/d8c0a88d0046225e5700f6ba7258da65/raw -o ${HOME}/.gitignore
    curl -L https://gist.github.com/vraravam/eab090e70a545934f409/raw -o ${HOME}/.gitconfig
    curl -L https://gist.github.com/vraravam/eb2161236d78fc0bda77/raw -o ${HOME}/.gemrc
    override-prompt https://gist.github.com/vraravam/d8c0a88d0046225e5700f6ba7258da65/raw ${HOME}/.gitignore
    override-prompt https://gist.github.com/vraravam/eab090e70a545934f409/raw ${HOME}/.gitconfig
    override-prompt https://gist.github.com/vraravam/eb2161236d78fc0bda77/raw ${HOME}/.gemrc

    ##################################
    # Install custom plugins for zsh #
    @@ -104,7 +118,7 @@ sudo chown -fR ${USERNAME}:admin ${HOMEBREW_PREFIX}
    #######################################
    type brew > /dev/null || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

    curl -L https://gist.github.com/vraravam/8c9eae91a3750bed86b81e3a4711f842/raw -o ${HOME}/Brewfile
    override-prompt https://gist.github.com/vraravam/8c9eae91a3750bed86b81e3a4711f842/raw ${HOME}/Brewfile
    brew bundle check || brew bundle --all || true

    ###########################################
  18. @vraravam vraravam revised this gist Jun 29, 2023. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -145,6 +145,7 @@ setup_login_item "KeepingYouAwake.app"
    setup_login_item "Keybase.app"
    setup_login_item "Rectangle.app"
    setup_login_item "Stats.app"
    setup_login_item "Command X.app"

    echo "********** Finished auto installation process: MANUALLY QUIT AND RESTART iTerm2 and Terminal apps **********"
    echo "1. Please ensure to edit the ${HOME}/.gitconfig* files to have your name and email configured instead of mine"
  19. @vraravam vraravam revised this gist Jun 27, 2023. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -76,7 +76,6 @@ curl -L https://gist.github.com/vraravam/93077cb859cdb64793cc500791da

    curl -L https://gist.github.com/vraravam/d8c0a88d0046225e5700f6ba7258da65/raw -o ${HOME}/.gitignore
    curl -L https://gist.github.com/vraravam/eab090e70a545934f409/raw -o ${HOME}/.gitconfig
    curl -L https://gist.github.com/vraravam/e9676759db46950e1fd817e49e513394/raw -o ${HOME}/.gitconfig-oss.inc
    curl -L https://gist.github.com/vraravam/eb2161236d78fc0bda77/raw -o ${HOME}/.gemrc

    ##################################
  20. @vraravam vraravam revised this gist Jun 27, 2023. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -14,8 +14,8 @@ USERNAME=${USERNAME:-`whoami`}
    xcode-select -p > /dev/null
    if [ $? != 0 ]; then
    # install using the non-gui cmd-line alone
    touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress;
    softwareupdate -i -a
    touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
    softwareupdate -ia
    rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
    sudo xcodebuild -license accept || true
    fi
  21. @vraravam vraravam revised this gist Jun 19, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -136,7 +136,7 @@ ln -sf "${HOMEBREW_PREFIX}/bin/codium-insiders" "${HOMEBREW_PREFIX}/bin/code"

    # Setup login items
    setup_login_item() {
    osascript -e "tell application \"System Events\" to make login item at end with properties {path:\"/Applications/$1\", hidden:false}" 2>&1 > /dev/null
    test -d "/Applications/$1" && echo "Setting up $1 as a login item" && osascript -e "tell application \"System Events\" to make login item at end with properties {path:\"/Applications/$1\", hidden:false}" 2>&1 > /dev/null
    }
    setup_login_item "Clocker.app"
    setup_login_item "Flycut.app"
  22. @vraravam vraravam revised this gist Jun 19, 2023. 1 changed file with 13 additions and 1 deletion.
    14 changes: 13 additions & 1 deletion fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -132,9 +132,21 @@ ln -sf "${HOMEBREW_PREFIX}/bin/codium-insiders" "${HOMEBREW_PREFIX}/bin/code"
    # defaults write -g NSFileViewer -string org.yanex.marta
    # To revert back to use Finder as default file manager you can enter
    # defaults delete -g NSFileViewer

    # ln -sf /Applications/Marta.app/Contents/Resources/launcher ${HOMEBREW_PREFIX}/bin/marta

    # Setup login items
    setup_login_item() {
    osascript -e "tell application \"System Events\" to make login item at end with properties {path:\"/Applications/$1\", hidden:false}" 2>&1 > /dev/null
    }
    setup_login_item "Clocker.app"
    setup_login_item "Flycut.app"
    setup_login_item "iBar.app"
    setup_login_item "Itsycal.app"
    setup_login_item "KeepingYouAwake.app"
    setup_login_item "Keybase.app"
    setup_login_item "Rectangle.app"
    setup_login_item "Stats.app"

    echo "********** Finished auto installation process: MANUALLY QUIT AND RESTART iTerm2 and Terminal apps **********"
    echo "1. Please ensure to edit the ${HOME}/.gitconfig* files to have your name and email configured instead of mine"
    echo "2. Go to iTerm2 > Preferences > Profiles > Default > Text > Change Font to 'MesloLGS Nerd Font'"
  23. @vraravam vraravam revised this gist Jun 19, 2023. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -67,6 +67,7 @@ export ZSH=
    [ ! -d ${HOME}/.oh-my-zsh ] && curl -L http://install.ohmyz.sh | sh

    curl -L https://gist.github.com/vraravam/a64d51fff250271aa7669438db5bd6a5/raw -o ${HOME}/.zshenv
    curl -L https://gist.github.com/vraravam/51e0516f5d7c6beec67668d1a31b7da8/raw -o ${HOME}/.zlogin
    curl -L https://gist.github.com/vraravam/ce8654afd65def117dc17e2b0a30156c/raw -o ${HOME}/.zprofile
    curl -L https://gist.github.com/vraravam/657c3b94d1b04bacd2b6a38c22d6ec56/raw -o ${HOME}/.zshrc
    curl -L https://gist.github.com/vraravam/9c8d9f335159f90c3fff890bcf3856d6/raw -o ${HOME}/.zshrc.custom
  24. @vraravam vraravam revised this gist Jun 19, 2023. 1 changed file with 0 additions and 5 deletions.
    5 changes: 0 additions & 5 deletions fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -107,11 +107,6 @@ type brew > /dev/null || /bin/bash -c "$(curl -fsSL https://raw.githubuserconten
    curl -L https://gist.github.com/vraravam/8c9eae91a3750bed86b81e3a4711f842/raw -o ${HOME}/Brewfile
    brew bundle check || brew bundle --all || true

    ###################################################
    # Compile zsh config files for faster performance #
    ###################################################
    curl -L https://gist.github.com/vraravam/76880d9ab0f355bfc521eaf23efc9d6e/raw | zsh

    ###########################################
    # Link programs to open from the cmd-line #
    ###########################################
  25. @vraravam vraravam revised this gist Jun 19, 2023. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -90,6 +90,7 @@ ZSH_CUSTOM=${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}
    ################################
    # Prep for installing homebrew #
    ################################
    source ${HOME}/.zshenv
    source ${HOME}/.zprofile
    # TODO: Don't run this here - it fails (need to figure out how to fix it)
    # exec zsh
  26. @vraravam vraravam revised this gist Jun 19, 2023. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -138,8 +138,7 @@ ln -sf "${HOMEBREW_PREFIX}/bin/codium-insiders" "${HOMEBREW_PREFIX}/bin/code"

    # ln -sf /Applications/Marta.app/Contents/Resources/launcher ${HOMEBREW_PREFIX}/bin/marta

    echo "********** Finished auto installation process **********"
    echo "********** MANUALLY QUIT AND RESTART iTerm2 and Terminal apps **********"
    echo "********** Finished auto installation process: MANUALLY QUIT AND RESTART iTerm2 and Terminal apps **********"
    echo "1. Please ensure to edit the ${HOME}/.gitconfig* files to have your name and email configured instead of mine"
    echo "2. Go to iTerm2 > Preferences > Profiles > Default > Text > Change Font to 'MesloLGS Nerd Font'"
    echo "3. Go to Terminal > Preferences > Profiles > Basic > Text > Change Font to 'MesloLGS Nerd Font'"
  27. @vraravam vraravam revised this gist Jun 19, 2023. 1 changed file with 6 additions and 11 deletions.
    17 changes: 6 additions & 11 deletions fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -132,20 +132,15 @@ ln -sf "${HOMEBREW_PREFIX}/bin/codium-insiders" "${HOMEBREW_PREFIX}/bin/code"
    # Setup idea for use from the cmd-line
    # replace_executable_if_exists_and_is_not_symlinked "/Applications/IntelliJ IDEA CE.app/Contents/MacOS/idea" "${HOMEBREW_PREFIX}/bin/idea"

    #######################################
    # Install font for better readability #
    #######################################
    # <Go to iTerm2 > Preferences > Profiles > Default > Text > Change Font to 'MesloLGS Nerd Font'>
    # <Go to Terminal > Preferences > Profiles > Basic > Text > Change Font to 'MesloLGS Nerd Font'>

    # Set shortcut key bindings on iTerm2
    # <Go to iTerm2 > Preferences > Profiles > Default > Keys > Key Mappings > Presets (and choose 'Natural Text Editing')>

    # defaults write -g NSFileViewer -string org.yanex.marta
    # To revert back to use Finder as default file manager you can enter
    # defaults delete -g NSFileViewer

    # ln -sf /Applications/Marta.app/Contents/Resources/launcher ${HOMEBREW_PREFIX}/bin/marta

    echo "********** QUIT AND RESTART iTerm2/Terminal since 'exec zsh' will not reload fonts **********"
    echo "********** Finished auto installation process - please continue beyond this in a manual manner **********"
    echo "********** Finished auto installation process **********"
    echo "********** MANUALLY QUIT AND RESTART iTerm2 and Terminal apps **********"
    echo "1. Please ensure to edit the ${HOME}/.gitconfig* files to have your name and email configured instead of mine"
    echo "2. Go to iTerm2 > Preferences > Profiles > Default > Text > Change Font to 'MesloLGS Nerd Font'"
    echo "3. Go to Terminal > Preferences > Profiles > Basic > Text > Change Font to 'MesloLGS Nerd Font'"
    echo "4. Go to iTerm2 > Preferences > Profiles > Default > Keys > Key Mappings > Presets (and choose 'Natural Text Editing')"
  28. @vraravam vraravam revised this gist Jun 8, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -101,7 +101,7 @@ sudo chown -fR ${USERNAME}:admin ${HOMEBREW_PREFIX}
    #######################################
    # Install homebrew (on empty machine) #
    #######################################
    type brew || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
    type brew > /dev/null || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

    curl -L https://gist.github.com/vraravam/8c9eae91a3750bed86b81e3a4711f842/raw -o ${HOME}/Brewfile
    brew bundle check || brew bundle --all || true
  29. @vraravam vraravam revised this gist Jun 8, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ USERNAME=${USERNAME:-`whoami`}
    ##################################
    # Install command line dev tools #
    ##################################
    xcode-select -p
    xcode-select -p > /dev/null
    if [ $? != 0 ]; then
    # install using the non-gui cmd-line alone
    touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress;
  30. @vraravam vraravam revised this gist Jun 8, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion fresh-install-of-osx.sh
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    # file location: <anywhere> (just need to invoke it from that location)

    # You can run this script using this command:
    # curl -L https://gist.github.com/vraravam/04fc2296b25090ea848642afbce4d168/raw | sh
    # curl -L https://gist.github.com/vraravam/04fc2296b25090ea848642afbce4d168/raw | bash

    USERNAME=${USERNAME:-`whoami`}