Skip to content

Instantly share code, notes, and snippets.

@d1820
Last active February 8, 2024 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d1820/b98dccfd1fff6883e1c51c409eadbff9 to your computer and use it in GitHub Desktop.
Save d1820/b98dccfd1fff6883e1c51c409eadbff9 to your computer and use it in GitHub Desktop.
Install Terminal Icons and POSH for Mac
#!/bin/bash
# Set default value for theme if not provided
theme=${1:-'quick-term.omp.json'}
font=${2:-'Meslo'}
echo 'Installing Posh...'
brew install jandedobbeleer/oh-my-posh/oh-my-posh
echo 'Installing Font...'
if find /Library/Fonts -type f -name '$font*' | grep -q '$font'; then
echo 'Font $font already installed'
else
$(brew --prefix)/bin/oh-my-posh font install $font
fi
echo 'Updating Profile...'
if [ -f ~/.bashrc ]; then
path=$(ls ~/.bashrc)
echo "eval \"\$(oh-my-posh init bash --config \$(brew --prefix oh-my-posh)/themes/$theme)\"">>$path
fi
if [ -f ~/.zshrc ]; then
path=$(ls ~/.zshrc)
echo "eval \"\$(oh-my-posh init zsh --config \$(brew --prefix oh-my-posh)/themes/$theme)\"">>$path
fi
echo ''
echo 'Posh Installed Successfully. Reload bash 'exec bash/zsh''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment