Skip to content

Instantly share code, notes, and snippets.

@yuripourre
Last active August 8, 2025 22:54
Show Gist options
  • Save yuripourre/3d49e2e99924774d057ad0012159e390 to your computer and use it in GitHub Desktop.
Save yuripourre/3d49e2e99924774d057ad0012159e390 to your computer and use it in GitHub Desktop.
Mac Setup
setopt interactivecomments
# The command above allows you to have bash style comments
# Create .zshrc file
touch ~/.zshrc
# Enable git tab for branch completion
echo 'autoload -Uz compinit && compinit' >> ~/.zshrc
# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
echo "export PATH=/opt/homebrew/bin:\$PATH" >> ~/.zshrc
# Install MacPorts
xcode-select --install
curl https://github.com/macports/macports-base/releases/download/v2.8.1/MacPorts-2.8.1-13-Ventura.pkg
sudo installer -pkg MacPorts-2.8.1-13-Ventura.pkg -target /
# Setup Requirements
sudo port load dbus
sudo port select --set python3 python311
# Install Gedit
yes | sudo port install gedit
# Installing Meld
yes | sudo port install meld
git config --global merge.tool meld
# Install Git
arch -arm64 brew install git
#git config --global user.name "Yuri Pourre"
#git config --global user.email "[email protected]"
# Install NVM
arch -arm64 brew update
arch -arm64 brew install nvm
mkdir ~/.nvm
echo "export NVM_DIR=~/.nvm\nsource \$(brew --prefix nvm)/nvm.sh" >> ~/.zshrc
# Azure command line tools
arch -arm64 brew install azure-cli
# Installing docker runtime (colima)
arch -arm64 brew install colima
colima start
# Create a link so testcontainers works and it works similar to docker
sudo ln -s $HOME/.colima/docker.sock /var/run/docker.sock
# Installing Java OpenJDK 17
arch -arm64 brew install openjdk@17
echo "export JAVA_HOME==`/usr/libexec/java_home -v 17`" >> ~/.zshrc
source ~/.zshrc
@yuripourre
Copy link
Author

yuripourre commented Dec 7, 2022

# Color list (Zsh-safe with %{ %} wrapping)
COLOR_RESET='%{\033[0m%}'
COLOR_GREEN='%{\033[0;32m%}'
COLOR_LIGHT_GREEN='%{\033[1;32m%}'
COLOR_CYAN='%{\033[0;36m%}'
COLOR_PURPLE='%{\033[0;35m%}'
COLOR_ORANGE='%{\033[0;33m%}'
COLOR_RED='%{\033[0;31m%}'

# Git status color function
git_color() {
  git rev-parse --is-inside-work-tree &>/dev/null || return
  local git_status
  git_status=$(git status --porcelain 2>/dev/null)

  if echo "$git_status" | grep -q "^A "; then
    echo -n "$COLOR_GREEN"
  elif echo "$git_status" | grep -q "^[MDRCT]"; then
    echo -n "$COLOR_LIGHT_GREEN"
  elif echo "$git_status" | grep -q "^ M"; then
    echo -n "$COLOR_CYAN"
  elif echo "$git_status" | grep -q "^??"; then
    echo -n "$COLOR_PURPLE"
  elif [ -z "$git_status" ]; then
    echo -n "$COLOR_ORANGE"
  else
    echo -n "$COLOR_RED"
  fi
}

get_git_branch() {
  local branch
  if git rev-parse --is-inside-work-tree &>/dev/null; then
    branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
    echo "($branch)"
  fi
}

PROMPT='%n %~ $(git_color)$(get_git_branch)$(echo -n $COLOR_RESET)$ '

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment