Skip to content

Instantly share code, notes, and snippets.

@howie
Last active September 12, 2023 03:20
Show Gist options
  • Save howie/00ae971f711b610e02fa to your computer and use it in GitHub Desktop.
Save howie/00ae971f711b610e02fa to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
#Referecne:
# 1. https://gist.github.com/zenorocha/7159780
# 2. https://gist.github.com/agnoster/3712874
# 3. https://github.com/digitalformula/zsh.prompts
# Shared functions
pretty_print() {
printf "\n%b\n" "$1"
}
asdf_install_packages() {
local tool
local version
for pkg in "$@"; do
# Splitting tool and version based on ':'
IFS=":" read -r tool version <<< "$pkg"
# Check if the tool is already added to asdf
if ! asdf plugin-list | grep -q "$tool"; then
echo "Adding plugin: $tool"
asdf plugin-add "$tool"
fi
# Check if the version is already installed
if ! asdf list "$tool" | grep -q "$version"; then
echo "Installing $tool version $version"
asdf install "$tool" "$version"
else
echo "$tool version $version is already installed."
fi
done
}
######
pretty_print "Here we go..."
# So it begins
#install xcode command tool
if [ ! -d "/Library/Developer/CommandLineTools" ]; then
xcode-select --install
# check
xcode-select -p
else
echo "Xcode Command Line Tools are already installed."
fi
# Homebrew installation
if ! command -v brew &>/dev/null; then
pretty_print "Installing Homebrew, an OSX package manager, follow the instructions..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> ~/.zshrc
eval "$(/opt/homebrew/bin/brew shellenv)"
if ! grep -qs "recommended by brew doctor" ~/.zshrc; then
pretty_print "Put Homebrew location earlier in PATH ..."
printf '\n# recommended by brew doctor\n' >> ~/.zshrc
printf 'export PATH="/usr/local/bin:$PATH"\n' >> ~/.zshrc
export PATH="/usr/local/bin:$PATH"
fi
else
pretty_print "You already have Homebrew installed...good job!"
fi
# Homebrew OSX libraries
pretty_print "Updating brew formulas"
brew update
# File transfer
pretty_print "Install file transfer package...."
brew install wget
brew install curl
brew install ctags
brew install git
brew install git-lfs
git lfs install
#
# Install YARD dotfile
#
#
pretty_print "Install YARD dotfile...."
sh -c "`curl -fsSL https://gist.githubusercontent.com/howie/f05ed791b26753be24beb7b028cc8624/raw/install-yard.sh`"
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed
pretty_print "Installing GNU core utilities..."
brew install coreutils
if ! grep -q "brew --prefix coreutils" $HOME/.zshrc; then
echo 'export PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH"' >> ~/.zshrc
export PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH"
fi
pretty_print "Installing GNU find, locate, updatedb and xargs..."
brew install findutils
pretty_print "Installing the most recent verions of some OSX tools"
# https://duck.sh/
brew install duck
# development
brew install --cask jetbrains-toolbox
brew install --cask visual-studio-code
pretty_print "Start install asdf and plugin...."
# Programing language
brew install asdf
if ! grep -q "asdf.sh" $HOME/.zshrc; then
echo -e ". $(brew --prefix asdf)/libexec/asdf.sh" >> ${ZDOTDIR:-~}/.zshrc
fi
asdf_install_packages "golang:latest" "terraform:latest" "rclone:latest" "conan:latest" "gradle:latest" "python:latest" "nodejs:latest" "java:temurin-17.0.8+101"
# Install useful command line tools
brew install ack # grep for source code
brew install jq # grep for json
brew install json2tsv
brew install tree # recursive directory listing command
brew install webkit2png # captures webpage screenshots
# Cloud cli
brew install awscli
brew install az
# Remote Access
# brew cask install royal-tsx
brew install iterm2
# for compare file
brew install sourcetree
# VM
#brew install virtualbox
#brew install vagrant
# Install VirtualBox Guest Additions
#vagrant plugin install vagrant-vbguest
# Running Docker (http://jesperrasmussen.com/2014/06/02/running-docker-on-homebrew/)
#brew install docker
#brew install podman
brew install orbstack
# Android
brew install android-sdk
brew install android-platform-tools
# DB Monitor
# brew cask install sequel-pro
# brew cask install pgadmin3
# brew cask install dbeaver-enterprise
#Redis Monitor
# brew cask install rdm
# Editor
brew unlink macvim
brew install vim
brew install textmate
# System Monitor
brew install htop-osx
# Broswer
brew install --cask microsoft-edge
#brew install --cask brave
#brew install --cask firefox
# Communication
brew install telegram
brew install discord
#
# 2023 need to use company version
#
#brew install --cask zoom
#brew install --cask slack
#brew install --cask microsoft-teams
brew install --cask grammarly
brew install --cask miro
# Cloud Storage
brew install --cask dropbox
brew install --cask google-drive
brew install --cask onedrive
# Entrainment
brew install --cask spotify
brew install --cask vlc
brew tap homebrew-ffmpeg/ffmpeg
brew install homebrew-ffmpeg/ffmpeg/ffmpeg
# Markdown editor for developers.
# brew install --cask mou
# other
brew install readline
brew install openssl
#
# Note
#
#brew install --cask heptabase
brew install --cask evernote
brew install --cask obsidian
brew install --cask notion
#
# brew install --cask raycast
# brew install --cask bettertouchtool
# brew install --cask xquartz
# System Clean
brew install --cask appcleaner
# install QuickLook
# https://github.com/sindresorhus/quick-look-plugins
brew install qlcolorcode qlstephen qlmarkdown quicklook-json qlimagesize suspicious-package apparency quicklookase qlvideo
pretty_print "Finish install, remove outdated versions from the cellar...."
# Remove outdated versions from the cellar
brew cleanup
pretty_print "Update zshrc...."
if ! grep -q "alias updatedb" $HOME/.zshrc; then
pretty_print "Install alias updatedb"
echo "alias updatedb=\"sudo /usr/libexec/locate.updatedb\"">> ~/.zshrc
echo '. <(azure --completion)' >> ~/.zshrc
fi
#https://github.com/gcuisinier/jenv
#jenv enable-plugin gradle
#jenv enable-plugin maven
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment