-
-
Save shivashishrs/a161bd2082fb15d9bfbc138e88a089f6 to your computer and use it in GitHub Desktop.
Steps to get "up and running" with new Mac OSX
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
| #!/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. | |
| # 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 | |
| USERNAME=${USERNAME:-`whoami`} | |
| ################################## | |
| # Install command line dev tools # | |
| ################################## | |
| 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 | |
| rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress | |
| sudo xcodebuild -license accept || true | |
| fi | |
| ############################### | |
| # Do not allow rootless login # | |
| ############################### | |
| # Note: Commented out since I am not sure if we need to do this on the office MBP or not | |
| # ROOTLESS_STATUS=$(/usr/bin/csrutil status | awk '/status/ {print $5}' | sed 's/\.$//') | |
| # if [[ ${ROOTLESS_STATUS} == "enabled" ]]; then | |
| # echo "csrutil (\"rootless\") is enabled. please disable in boot screen and run again!" | |
| # exit 1 | |
| # fi | |
| ##################### | |
| # Turn on FileVault # | |
| ##################### | |
| FILEVAULT_STATUS=$(fdesetup status) | |
| if [[ ${FILEVAULT_STATUS} != "FileVault is On." ]]; then | |
| echo "FileVault is not turned on. Please encrypt your hard disk!" | |
| exit 1 | |
| fi | |
| ################################# | |
| # Setup ssh scripts/directories # | |
| ################################# | |
| mkdir -p ${HOME}/.ssh | |
| sudo chmod -R 600 ${HOME}/.ssh/* | |
| ############################ | |
| # Disable macos gatekeeper # | |
| ############################ | |
| # sudo spectl --master-disable | |
| ###################### | |
| # vim configurations # | |
| ###################### | |
| curl -L https://gist.github.com/vraravam/2d8654cb21bfe506a64a05a49268d9de/raw -o ${HOME}/.vimrc | |
| ###################################################################################### | |
| # Setup any sudo access password from cmd-line to also invoke the gui touchId prompt # | |
| ###################################################################################### | |
| curl -L https://gist.github.com/vraravam/0579373b2028e9b5b08ae87fb39c09d8/raw | sh | |
| ##################### | |
| # Install oh-my-zsh # | |
| ##################### | |
| 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/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 | |
| 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 | |
| ################################## | |
| # 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 | |
| # 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 | |
| ################################ | |
| # Prep for installing homebrew # | |
| ################################ | |
| 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 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)" | |
| 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 # | |
| ########################################### | |
| replace_executable_if_exists_and_is_not_symlinked() { | |
| test -e "$1" && rm -fv "$2"; ln -sf "$1" "$2" | |
| } | |
| # 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" | |
| # 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" | |
| # extra: also symlink for 'code' | |
| ln -sf "${HOMEBREW_PREFIX}/bin/codium-insiders" "${HOMEBREW_PREFIX}/bin/code" | |
| # Setup rider for use from the cmd-line | |
| # replace_executable_if_exists_and_is_not_symlinked "/Applications/Rider.app/Contents/MacOS/rider" "${HOMEBREW_PREFIX}/bin/rider" | |
| # 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 **********" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment