Skip to content

Instantly share code, notes, and snippets.

@tillig
Last active April 8, 2022 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tillig/564d718bc4b29f8b9acc2524f96b0b7d to your computer and use it in GitHub Desktop.
Save tillig/564d718bc4b29f8b9acc2524f96b0b7d to your computer and use it in GitHub Desktop.
Automated environment setup for Mac
NAME="Travis Illig"
EMAIL="travis.illig@fiserv.com"
USER="tillig"
echo "MAC ENVIRIONMENT SETUP"
echo "----------------------"
echo "Sign in to Mac App Store before proceeding. Homebrew package restore may need to restore app store items."
read -p "Press any key to continue… " -n1 -s
echo ""
echo "FINDER"
echo "------"
echo "- Always showing hidden files."
defaults write com.apple.finder AppleShowAllFiles YES
echo ""
echo "HOMEBREW"
echo "--------"
if test ! $(which brew)
then
echo "- Installing Homebrew for you."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" > /tmp/homebrew-install.log
fi
echo "- Taking ownership of pkgconfig"
sudo chown -R $(whoami) /usr/local/lib/pkgconfig
echo "- Restoring/updating packages"
brew update
brew upgrade
# To create a Brewfile:
# brew bundle dump
[[ -f Brewfile ]] && brew bundle install
if test $(which tfenv)
then
echo "- Initializing Terraform with latest version"
tfenv install latest
tfenv use latest
fi
if test $(which tgenv)
then
echo "- Initializing Terragrunt with latest version"
tgenv install latest
tgenv use latest
fi
echo "- Linking OpenJDK if needed"
[[ ! -d /Library/Java/JavaVirtualMachines/openjdk.jdk ]] && [[ -d $(brew --prefix)/opt/openjdk/libexec/openjdk.jdk ]] && sudo ln -sfn $(brew --prefix)/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
echo ""
echo "GIT"
echo "---"
git config --global user.name $NAME
git config --global user.email $EMAIL
git config --global credential.helper /usr/local/share/gcm-core/git-credential-manager-core
# Need to use HTTP path in creds because the AzDO org is different by path.
git config --global credential.dev.azure.com.usehttppath=true
# If you've already logged in at some point, you may need to clear the
# credentials for dev.azure.com or it won't let you switch between orgs.
# https://stackoverflow.com/questions/11067818/how-do-you-reset-the-stored-credentials-in-git-credential-osxkeychain
# $ git credential-osxkeychain erase ⏎
# host=dev.azure.com ⏎
# protocol=https ⏎
# ⏎
# ⏎
echo ""
echo "AZURE ARTIFACTS CREDENTIAL PROVIDER FOR NUGET"
echo "---------------------------------------------"
curl -fsSL https://aka.ms/install-artifacts-credprovider.sh | bash
echo ""
echo "POWERSHELL PROFILE"
echo "------------------"
if [[ ! -d ~/dev/$USER/PowerShellProfile ]]
then
# Profile gets symlinked to ~/.config/powershell
# Modules get symlinked to ~/.local/share/powershell/Modules
git clone https://github.com/tillig/PowerShellProfile.git ~/dev/$USER/PowerShellProfile
[[ -d ~/.config ]] || mkdir -p ~/.config
[[ ! -d ~/.config/powershell ]] || rm -rf ~/.config/powershell
ln -s ~/dev/$USER/PowerShellProfile ~/.config/powershell
[[ -d ~/.local/share/powershell ]] || mkdir -p ~/.local/share/powershell
[[ ! -d ~/.local/share/powershell/Modules ]] || rm -rf ~/.local/share/powershell/Modules
ln -s ~/dev/$USER/PowerShellProfile/Modules ~/.local/share/powershell/Modules
pwsh ~/.config/powershell/Install-ProfileModules.ps1
fi
# Not automated
echo ""
echo "Done with automated items."
echo ""
echo "MANUAL ITEMS"
echo "------------"
echo "Install these manually (in this order):"
echo " - Mono: https://mono-project.com/download/stable and install the Visual Studio channel"
echo " - .NET Core SDK: https://dotnet.microsoft.com/download"
echo " - VS Code: https://code.visualstudio.com/download"
echo " - Beyond Compare: https://www.scootersoftware.com/download.php?zz=kb_mac"
echo ""
echo "Also..."
echo " - Get software updates"
echo " sudo softwareupdate --all --install --force --agree-to-license --verbose --restart"
echo " - Update /etc/hosts"
echo " - Update /etc/paths"
echo " - Set host name:"
echo " sudo scutil --set HostName osx-host-name-here"
echo " sudo scutil --set LocalHostName osx-host-name-here"
echo " dscacheutil -flushcache"
echo " - Turn off Spotlight Search: sudo mdutil -a -i off"
echo " - If the OS is fighting with CrowdStrike..."
echo " sudo /Applications/Falcon.app/Contents/Resources/falconctl uninstall"
echo " OR look at this script for some ideas..."
echo " https://github.com/t-lark/Falcon-Punch/blob/master/falcon_punch.py"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment