Skip to content

Instantly share code, notes, and snippets.

@guness
Last active April 11, 2025 08:34
Show Gist options
  • Save guness/f4df55c9ef16ce05105329637083ceb2 to your computer and use it in GitHub Desktop.
Save guness/f4df55c9ef16ce05105329637083ceb2 to your computer and use it in GitHub Desktop.
MacOS global zsh profile file on /etc/zprofile
# System-wide profile for interactive zsh(1) login shells.
# Setup user specific overrides for this in ~/.zprofile. See zshbuiltins(1)
# and zshoptions(1) for more details.
if [ -x /usr/libexec/path_helper ]; then
paths=`/usr/libexec/path_helper -s`
eval ${paths//'\$USER'/$'$USER'}
fi
alias j21='if JAVA_21_HOME=$(/usr/libexec/java_home -v 21 2>/dev/null); then export JAVA_HOME="$JAVA_21_HOME"; $JAVA_HOME/bin/java -version; else echo "Java 21 is not installed"; fi'
alias j17='if JAVA_17_HOME=$(/usr/libexec/java_home -v 17 2>/dev/null); then export JAVA_HOME="$JAVA_17_HOME"; $JAVA_HOME/bin/java -version; else echo "Java 17 is not installed"; fi'
alias j11='if JAVA_11_HOME=$(/usr/libexec/java_home -v 11 2>/dev/null); then export JAVA_HOME="$JAVA_11_HOME"; $JAVA_HOME/bin/java -version; else echo "Java 11 is not installed"; fi'
alias j8='if [ -d "/Library/Java/JavaVirtualMachines/jdk-1.8.jdk/Contents/Home" ]; then export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-1.8.jdk/Contents/Home"; $JAVA_HOME/bin/java -version; else echo "Java 8 is not installed"; fi'
alias ja='if [ -d "/Applications/Android Studio.app/Contents/jbr/Contents/Home" ]; then export JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home"; $JAVA_HOME/bin/java -version; else echo "Android Studio JBR is not installed"; fi'
alias lg="lazygit"
export ANDROID_HOME=/Users/$USER/Library/Android/sdk
export ANDROID_SDK_ROOT=/Users/$USER/Library/Android/sdk
export JAVA_HOME='/Applications/Android Studio.app/Contents/jbr/Contents/Home'
# Source for below: https://github.com/mattjj/my-oh-my-zsh/blob/master/history.zsh
setopt BANG_HIST # Treat the '!' character specially during expansion.
setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format.
# setopt SHARE_HISTORY # Share history between all sessions.
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file.
setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry.
setopt HIST_VERIFY # Don't execute immediately upon history expansion.
setopt HIST_BEEP # Beep when accessing nonexistent history.
export LANG=en_US.UTF-8 # CocaPods needs this
export LC_ALL=en_US.UTF-8 # CocaPods needs this
# Ghostty Support
if [[ "$TERM_PROGRAM" == "ghostty" ]]; then
export TERM=xterm-256color
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment