Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Quick 'n dirty nice .bash_profile for OS X
# USE IF YOU HAVE
#export JAVA15_HOME="/System/Library/Java/JavaVirtualMachines/1.5.0/Contents/Home/"
#export PATH=${JAVA15_HOME}/bin:$PATH
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=${JAVA_HOME}/bin:$PATH
#export MAVEN_OPTS="-Xmx1024m -Xms1024m -XX:MaxPermSize=1162m"
#export M2_HOME=/usr/local/apache-maven-2.2.1
#export M2=$M2_HOME/bin
#export PATH=$M2:$PATH
export M2_HOME=/Applications/apache-maven-3.2.3
export PATH=$PATH:$M2_HOME/bin
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
export WORKSPACE=$HOME/Documents/workspace
export GITHUB=$WORKSPACE/github
export PATH=$HOME/bin:$PATH
export TM_RUBY=$HOME/.rvm/bin/ruby-rvm-env
export PATH="/usr/local/sbin:$PATH"
export GOPATH=$HOME/Documents/workspace/gocode
export PATH=$GOPATH/bin:$PATH
export TF=$HOME/bin/terraform_0
export PATH=$TF:$PATH
# homebrew completion
if which brew > /dev/null; then
source `brew --repository`/etc/bash_completion.d/brew
fi;
#if [ -f /etc/bash_completion ]; then
# source /etc/bash_completion
#fi
if [ -f /usr/local/git/contrib/completion/git-prompt.sh ]; then
source /usr/local/git/contrib/completion/git-prompt.sh
fi
if [ -f /usr/local/git/contrib/completion/git-completion.bash ]; then
source /usr/local/git/contrib/completion/git-completion.bash
fi
__has_parent_dir () {
# Utility function so we can test for things like .git/.hg without firing up a
# separate process
test -d "$1" && return 0;
current="."
while [ ! "$current" -ef "$current/.." ]; do
if [ -d "$current/$1" ]; then
return 0;
fi
current="$current/..";
done
return 1;
}
__vcs_name() {
if [ -d .svn ]; then
echo "-[svn]";
elif __has_parent_dir ".git"; then
echo "-[$(__git_ps1 'git %s')]";
elif __has_parent_dir ".hg"; then
echo "-[hg $(hg branch)]"
fi
}
black=$(tput -Txterm setaf 0)
red=$(tput -Txterm setaf 1)
green=$(tput -Txterm setaf 2)
yellow=$(tput -Txterm setaf 3)
dk_blue=$(tput -Txterm setaf 4)
pink=$(tput -Txterm setaf 5)
lt_blue=$(tput -Txterm setaf 6)
white=$(tput -Txterm setaf 7)
bold=$(tput -Txterm bold)
reset=$(tput -Txterm sgr0)
# Nicely formatted terminal prompt
export PS1='\n\[$bold\]\[$white\][\[$lt_blue\]\@\[$white\]]-[\[$green\]\u\[$yellow\]@\[$green\]\h\[$white\]]-[\[$pink\]\w\[$white\]]\[\033[0;33m\]$(__vcs_name) \[\033[00m\]\[$reset\]\n\[$reset\]\$ '
# USE IF YOU PREFER
#alias ls='ls -F --color=always'
#alias dir='dir -F --color=always'
#alias ll='ls -l'
#alias cp='cp -iv'
#alias rm='rm -i'
#alias mv='mv -iv'
#alias grep='grep --color=auto -in'
#alias v='vim'
#alias ..='cd ..'
# OTHER APPENDED CONFIG
export GOPATH=$HOME/Documents/workspace/gocode
export PATH=$GOPATH/bin:$PATH
#
# -- Yosemite config
# sudo ifconfig awdl0 down
# -- the default is:
# sudo ifconfig awdl0 up
##
# Keeps history of all terminal tabs
#
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
export HISTSIZE=100000 # big big history
export HISTFILESIZE=100000 # big big history
shopt -s histappend # append to history, don't overwrite it
# Save and reload the history after each command finishes
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
#
##
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards
[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2)" scp sftp ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment