Skip to content

Instantly share code, notes, and snippets.

@svagionitis
Last active December 17, 2015 21:29
Show Gist options
  • Save svagionitis/5674985 to your computer and use it in GitHub Desktop.
Save svagionitis/5674985 to your computer and use it in GitHub Desktop.
Dot file .bashrc Mac Os X 10.5.8 and 10.9.3
#-------------------------------------------------------------
# Source global definitions (if any)
#-------------------------------------------------------------
#if [ -f /etc/bashrc ]; then
# . /etc/bashrc # --> Read /etc/bashrc, if present.
#fi
# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
return
fi
# Make bash check its window size after a process completes
shopt -s checkwinsize
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
# Add colors for color prompt with git status/branch (From Dave)
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
DARKGREEN="\[\033[0;32m\]"
LIGHTGREEN="\[\033[01;32m\]"
BLUE="\[\033[01;34m\]"
WHITE="\[\033[00m\]"
# http://stackoverflow.com/questions/10435117/ps1-env-variable-does-not-work-on-mac
if [ -f /usr/local/git/contrib/completion/git-completion.bash ]; then
source /usr/local/git/contrib/completion/git-completion.bash
fi
if [ -f /opt/local/share/git/git-prompt.sh ]; then
source /opt/local/share/git/git-prompt.sh
fi
if [ "$color_prompt" = yes ]; then
PS1="$LIGHTGREEN\u@\h$WHITE:$RED\w$DARKGREEN\$(__git_ps1)$WHITE \$ "
else
PS1='\u@\h:\w\$ '
fi
#For time you could add \@ to PS1
PS1="(\$(date +%H:%M:%S)) $PS1"
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# Classpath addition for attica
CLASSPATH=$CLASSPATH:/Users/mac/My.Courses/ADBS/attica/Jattica/build/classes
export CLASSPATH
# Finished CLASSPATH
PATH=$PATH:/usr/local/mysql/bin
PATH=/opt/local/bin:$PATH
#The tools provided by GNU coreutils are prefixed with the character 'g' by default to distinguish them from the BSD commands.
#For example, cp becomes gcp and ls becomes gls.
#If you want to use the GNU tools by default, add this directory to the front of your PATH environment variable:
#PATH=$PATH:/opt/local/libexec/gnubin/
MANPATH=$MANPATH:/opt/local/share/man
#===============================================================
#
# ALIASES AND FUNCTIONS
#
# Arguably, some functions defined here are quite big.
# If you want to make this file smaller, these functions can
# be converted into scripts and removed from here.
#
# Many functions were taken (almost) straight from the bash-2.04
# examples.
#
#===============================================================
#-------------------
# Personnal Aliases
#-------------------
alias rm="rm -i"
alias cp="cp -i"
alias mv="mv -i"
# -> Prevents accidentally clobbering files.
alias mkdir="mkdir -p"
alias h="history"
alias ..="cd .."
alias du="du -kh" # Makes a more readable output.
alias df="df -kTh"
#-------------------------------------------------------------
# The 'ls' family (this assumes you use a recent GNU ls)
#-------------------------------------------------------------
alias ll="ls -alF"
alias la="ls -Al" # show hidden files
alias lk="ls -lSr" # sort by size, biggest last
alias lc="ls -ltcr" # sort by and show change time, most recent last
alias lu="ls -ltur" # sort by and show access time, most recent last
alias lt="ls -ltr" # sort by date, most recent last
alias lm="ls -al |more" # pipe through 'more'
alias lr="ls -lR" # recursive ls
alias l="ls -CF"
alias tree="tree -Csu" # nice alternative to 'recursive ls'
# If your version of 'ls' doesn't support --group-directories-first try this:
# function ll(){ ls -l "$@"| egrep "^d" ; ls -lXB "$@" 2>&-| \
# egrep -v "^d|total "; }
# History handling
#
# Erase duplicates
export HISTCONTROL=erasedups:ignoredups:ignorespace
# resize history size
export HISTSIZE=5000
export HISTFILESIZE=10000
# append to bash_history if Terminal.app quits
shopt -s histappend
#tells bash to append to ~/.bash_history any commands in the current terminal that aren't already in there.
#http://briancarper.net/blog/248/
export PROMPT_COMMAND="history -a"
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
# Install Golang
# http://justinlee.sg/2009/12/02/installing-go-language-on-mac-os-x/
# wherever your Go source directory will be
export GOROOT=$HOME/golang
# or 386 but it is recommended to use amd64
export GOARCH=amd64
export GOOS=darwin
export GOBIN=$HOME/bin # it will install the Go compiler here by default.
# add the $GOBIN into your path environment if you want to.
export PATH=$PATH:$GOBIN
# if you want to use the GNU tools by default, add this directory to the front of your PATH environment variable:
export PATH=/opt/local/libexec/gnubin/:$PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment