Skip to content

Instantly share code, notes, and snippets.

@reubenmiller
Created December 16, 2022 11:26
Show Gist options
  • Save reubenmiller/1015bea00a74832be59bce05ef146ffd to your computer and use it in GitHub Desktop.
Save reubenmiller/1015bea00a74832be59bce05ef146ffd to your computer and use it in GitHub Desktop.
mac install setup - homebrew without sudo
#!/bin/bash
# -------------------------------------------------------------------------------------------------------
# Pre-requisites
# This should be manually installed by the user (though it might be automatically installed by brew?)
# xcode-select --install
# -------------------------------------------------------------------------------------------------------
# Options
HOMEBREW_NO_SUDO=true
HOMEBREW_INSTALL_PATH=
HOMEBREW_INSTALL_VIA_TAR=
if [ -z "$HOMEBREW_INSTALL_PATH" ]; then
if [[ "$HOMEBREW_NO_SUDO" =~ yes|true|1 ]]; then
HOMEBREW_INSTALL_PATH=$HOME/homebrew
HOMEBREW_INSTALL_VIA_TAR=true
else
HOMEBREW_INSTALL_PATH="/opt/homebrew"
fi
fi
if ! [ -x "$(command -v brew)" ]; then
# Install brew
if [[ -n "$HOMEBREW_INSTALL_VIA_TAR" ]]; then
echo "Installing homebrew to $HOMEBREW_INSTALL_PATH"
mkdir -p "$HOMEBREW_INSTALL_PATH" && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
eval "$($HOMEBREW_INSTALL_PATH/bin/brew shellenv)"
brew update --force --quiet
chmod -R go-w "$(brew --prefix)/share/zsh"
else
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
# Add to shell profiles
echo "eval \"\$($HOMEBREW_INSTALL_PATH/bin/brew shellenv)\"" >> "$HOME/.bash_profile"
echo "eval \"\$($HOMEBREW_INSTALL_PATH/bin/brew shellenv)\"" >> "$HOME/.zshrc"
fi
# brew extentions
echo "Installing brew cask..."
brew tap homebrew/cask
brew tap homebrew/cask-versions
# brew installs
# Virtualization
brew install lima docker docker-credential-helper
brew install colima
brew install kubectl
brew install k9s
# brew install podman
# brew install fluxcd/tap/flux
brew install lzma
# ln -s /opt/homebrew/Cellar/zlib/1.2.11/lib/pkgconfig/zlib.pc /opt/homebrew/lib/pkgconfig/
brew install jpeg libpng libtiff pcre2 pkg-config tcl-tk xz zlib
# System tools
# note: iterm2,stats requires sudo
brew install iterm2
brew install --cask stats
brew install htop gtop glances
# languages
brew install golang
brew install rust
brew install dotnet
brew install node
brew install python@3.10
# brew install --cask dotnet-sdk
# linux build
brew install arm-linux-gnueabihf-binutils
# Cumulocity
brew tap reubenmiller/go-c8y-cli
brew update
brew install go-c8y-cli
if grep -v c8y.plugin.sh "$HOME/.bash_profile" >/dev/null 2>&1; then
echo 'source "$(brew --prefix)/etc/go-c8y-cli/shell/c8y.plugin.sh"' >> "$HOME/.bash_profile"
fi
if grep -v c8y.plugin.zsh "$HOME/.bash_profile" >/dev/null 2>&1; then
echo 'source "$(brew --prefix)/etc/go-c8y-cli/shell/c8y.plugin.zsh"' >> "$HOME/.zshrc"
fi
# https://github.com/ibraheemdev/modern-unix
# utilities
brew install curl
brew install jq
brew install yq
brew install bat
brew install azure-cli
brew install Azure/kubelogin/kubelogin
brew install coreutils
brew install parallel
brew install gnu-sed
ln -s "$(brew --prefix)/bin/gsed" "$(brew --prefix)/bin/sed"
# https://github.com/thomaspoignant/mac-dev-setup/blob/master/src/mac-dev-setup.sh
# MacOS utils
brew install mos # mouse scroll inverter
# VPN
brew install --cask openconnect-gui
# shells
brew install powershell --cask
brew install fish
brew install bash-completion
# fonts
brew tap homebrew/cask-fonts
brew install --cask font-hack-nerd-font
# utilities
# brew cask install BetterTouchTool
# keyboard layout editor
brew install --cask ukelele
# browsers
brew install google-chrome --cask
brew install firefox --cask
# editors
brew install visual-studio-code --cask
# custom apps
pip3 install c8ylp
# dev tools
# brew list mercurial || brew install mercurial
# install gvm
# if ! [ -x "$(command -v gvm)" ]; then
# bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
# source "$HOME/.gvm/scripts/gvm"
# gvm install go1.19 --prefer-binary
# gvm use go1.19 --default
# fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment