MacOS Bashrc
MacOS Bashrc - Starting to use the command line (or terminal) in Linux or MacOS X may be terribly daunting. it’s indeed a posh task to be told all of the commands and the way to use them along properly. Despite the training curve, using the command line will build plenty of tasks considerably faster and easier. a method to form the terminal easier to use is by making a .bashrc file.
Most Linux distributions (and MacOS X) use the Bash Shell because the default terminal shell (although I’ve heard some nice things regarding zsh). When initializing, Bash reads from a file referred to as .bashrc (in your home directory, aka ~/.bashrc). you’ll be able to add custom commands and shortcuts to the present file so you do not ought to bear in mind complicated commands and personalize the shell. Once creating changes to .bashrc, confirm to run supply ~/.bashrc to reload the file into the open shell.
MacOS X Bash Startup File
In case anyone needs a sample .bash_profile startup file for their MacOS X or other Unix/Linux system, I thought I’d share my most recent version here.
If you’re not familiar with a .bash_profile file, this is a startup file that is read whenever you open a new Terminal window. MacOS Bashrc a special configuration file, and it needs to be placed in your home directory. For instance, on my MacBook Pro, this file is located as/Users/al/.bash_profile.
MacOS bash_profile File Example
As you can see from my sample file shown below, the .bash_profile file can contain any legal Unix command, including Unix alias definitions, Unix export and PATH statements, and other commands to set up your Bash prompt (the PS1 syntax shown below).
With that brief introduction, here are the contents of my current MacOS bash_profile file :
# aliases
alias cd..="cd .."
alias l="ls -al"
alias lp="ls -p"
alias h=history
# the "kp" alias ("que pasa"), in honor of tony p.
alias kp="ps auxwww"
alias ss="/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background &"
# ant/java stuff
alias ant=/opt/local/bin/ant
export HOSTNAME=alsMac
export ANT_HOST_NAME=alsMac
export ANT_HOME=/opt/local/share/java/apache-ant
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0
export TOMCAT_HOME=/Users/al/tomcat-6.0.16
PATH=${JAVA_HOME}/bin:${PATH}:/usr/local/mysql/bin:/usr/local/ant-1.6.5/bin
# jruby
export JRUBY_HOME=/Users/al/Apps/jruby-0.9.2
PATH=${PATH}:/Users/al/Apps/jruby-0.9.2/bin
# maven 2.0.8 config
export M2_HOME=/Users/al/Local/maven-2.0.8
export M2=${M2_HOME}/bin
PATH=${M2}:${PATH}:
# general path munging
PATH=${PATH}:~/bin
PATH=${PATH}:/usr/local/bin
# postgres
export PATH=${PATH}:/usr/local/pgsql/bin
export PGDATA=/usr/local/pgsql/data
# configure my multi-line prompt
PS1='
$PWD
==> '
#-----#
# X11 #
#-----#
export DISPLAY=:0.0
PATH=${PATH}:/usr/X11R6/bin
If you’re familiar with Unix and Linux systems, MacOS Baschrc commands probably all look familiar. In my case they are just commands that help set up my Java, Ant, Ruby, Maven, and JRuby environments. That way, each time I open a new Terminal window, everything is set up and ready to go for me.
MacOS Bash Prompt Definition
In case MacOS Bash prompt (PS1) definition looks a little weird to you, I should mention that I use a multi-line prompt that looks like this :
/Users/al/Sites/devdaily.com ==> _
The first line of my prompt is actually an empty line, followed by the full path of the current directory on the second line, and MacOS Baschrc prompt symbol "==>" on the third line.








