Skip to content

Instantly share code, notes, and snippets.

@davidmroth
Last active November 11, 2022 01:04
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Homebrew Setup Mac M1
# !!! IMPORTANT
# Must point to the correct director or this entire script breaks
eval $(/opt/homebrew/bin/brew shellenv)
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/usr/local/google-cloud-sdk/path.bash.inc' ]; then . '/usr/local/google-cloud-sdk/path.bash.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/usr/local/google-cloud-sdk/completion.bash.inc' ]; then . '/usr/local/google-cloud-sdk/completion.bash.inc'; fi
export PATH="$(brew --prefix)/opt/coreutils/libexec/gnubin:/usr/local/google-cloud-sdk/bin/:$PATH"
alias ll="ls -lahk --group-directories-first --color=auto"
if type brew &>/dev/null; then
HOMEBREW_PREFIX="$(brew --prefix)"
if [[ -r "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" ]]; then
source "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh"
else
for COMPLETION in "${HOMEBREW_PREFIX}/etc/bash_completion.d/"*; do
[[ -r "$COMPLETION" ]] && source "$COMPLETION"
done
fi
fi
if ( test -z "$(git config --global credential.helper)" ); then
git config --global credential.helper store
fi
if test -f $(brew --prefix)/etc/bash_completion; then
# Install kubectl command completion
if ! test -e "${HOMEBREW_PREFIX}/etc/bash_completion.d/kubectl"; then
kubectl completion bash > "${HOMEBREW_PREFIX}/etc/bash_completion.d/kubectl"
fi
source <(kubectl completion bash)
complete -F __start_kubectl k
# Install docker/docker-compose command completion using Docker Desktop
etc=/Applications/Docker.app/Contents/Resources/etc
if test -e $etc; then
if ! test -e "$(brew --prefix)/etc/bash_completion.d/docker"; then
ln -s $etc/docker.bash-completion $(brew --prefix)/etc/bash_completion.d/docker
fi
if ! test -e "$(brew --prefix)/etc/bash_completion.d/docker-compose"; then
ln -s $etc/docker-compose.bash-completion $(brew --prefix)/etc/bash_completion.d/docker-compose
fi
fi
source $(brew --prefix)/etc/bash_completion
complete -F _docker_compose dc
fi
#Custom commands
alias dc="docker-compose"
alias k="kubectl"
alias brew='arch -x86_64 brew'
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
sudo vim /etc/shells
- append "$(brew --prefix)/bin/bash"
brew install coreutils findutils gnu-tar gnu-sed gawk gnutls gnu-indent gnu-getopt grep vim bash-completion
# https://mager.co/posts/2021-01-21-gcloud-mac-m1/
cd /usr/local/
curl https://sdk.cloud.google.com | bash
cd ~/google-cloud-sdk
./install.sh --override-components core gcloud-deps bq gcloud gsutil
# https://piyush-agrawal.medium.com/setting-up-linux-vm-on-apple-silicon-for-docker-e5b9924fd09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment