Skip to content

Instantly share code, notes, and snippets.

@istvan-antal
Created October 26, 2012 06:50
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 istvan-antal/3957304 to your computer and use it in GitHub Desktop.
Save istvan-antal/3957304 to your computer and use it in GitHub Desktop.
Awesome Shell OS X
sudo port selfupdate
sudo port upgrade outdated
sudo port install bash
sudo port install bash-completion
sudo port install git-core +bash-completion +doc +svn
sudo port install git-extras

(Optional) Set a safe git push.default

git config --global push.default simple

(Optional) Set git to use shell colors

git config --global color.ui true

Add to ~/.profile

if [ -f /opt/local/etc/bash_completion ]; then
    . /opt/local/etc/bash_completion
fi

if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then
  . /opt/local/etc/profile.d/bash_completion.sh
fi

if [ -f /opt/local/share/git-core/git-prompt.sh ]; then
    . /opt/local/share/git-core/git-prompt.sh
fi

Follow: Step 3: Use bash from MacPorts in your terminal

https://trac.macports.org/wiki/howto/bash-completion

wget --no-check-certificate https://gist.github.com/raw/3957460/145aabd9a00118069e9ba6194380bbbf0e209e57/.variables

Add to ~/.profile

. ~/.variables

# Various variables you might want for your PS1 prompt instead
Time12h="\T"
Time12a="\@"
PathShort="\w"
PathFull="\W"
NewLine="\n"
Jobs="\j"
HostName="\h"
UserName="\u"

PSUserHostColor="$White"
PSDirColor=$Blue

PS1=$PSUserHostColor$UserName@$HostName$Color_Off' ''$(git branch &>/dev/null;\
if [ $? -eq 0 ]; then \
 echo "$(echo `git status` | grep "nothing to commit" > /dev/null 2>&1; \
 if [ "$?" -eq "0" ]; then \
   # @4 - Clean repository - nothing to commit
   echo "'$PSDirColor''$PathShort''$Green'"$(__git_ps1 " (%s)"); \
 else \
   # @5 - Changes to working tree
   echo "'$PSDirColor''$PathShort''$IRed'"$(__git_ps1 " {%s}"); \
 fi) '$Color_Off'\$ "; \
else \
 # @2 - Prompt when not in GIT repo
 echo "'$PSDirColor$PathShort$Color_Off' \$ "; \
fi)'

Alternatively tweak the PSUserHostColor and PSDirColor variables.

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