I want to install rvm on my Snow Leopard machine.
It says I need to add a line to my
.bashrc file (I'm using bash) but where is my
Regarding the problem with
On most systems,
~/.bashrc is only used when starting an interactive non-login shell. However, when you start up a new shell it is often an interactive login shell. Since this is a login shell, the
.bashrc is ignored. To keep the environment consistent between non-login and login shells, you must source the
.bashrc from your
.profile or your
See the Bash Reference Manual, section 6.2 Bash Startup Files
Invoked as an interactive login shell, or with --login
When Bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.
Invoked as an interactive non-login shell
When an interactive shell that is not a login shell is started, Bash reads and executes commands from ~/.bashrc, if that file exists.
So, typically, your ~/.bash_profile contains the line
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
after (or before) any login-specific initializations.
On my Mac (Running Leopard), there was no line to source
~/.bashrc. I had to add this functionality on my own.
On some systems and other OSes,
.bashrc is sourced from the global
/etc/bash_profile , or is done using the template files from
To be honest the distinction between
.bash_profile is not well understood by the community. When many developers say "Add this to your .bashrc", what they really mean is "Add this to your .bash_profile". They want the functionality to be added to your login shell (which is
.bash_profile), not to your non-login shell. In reality, it doesn't usually matter and placing configuration in
.bashrc is acceptable.
So turns out that on Mac OS X Snow Leopard as well as Mac OS X Lion, the file that's loaded is called
What you want to do is create a file in
~/.profile and call it .profile (if it doesn't already exists).
Put whatever information you needed to load with each instance of bash there (Thanks, thepurplepixel).
A couple of side notes:
-aas a parameter as such:
~symbol stands for
/Users/YourUserNamewhere YourUserName is your username's shortname.
Edit: Chris Page notes (correctly) that whatever you place in a .profile file will apply to whatever shell you're using (i.e. zhs, bash, et cetera). If you want the contents to affect only the bash shell, place the contents in a
.bash_profile file instead of a
You have to make your own
.bashrc. You can simply use a text editor to make a file called
.bashrc (no extension) with the contents you want and save it in your home directory (
I find that in my OS 10.6.5 the bash settings are in "/etc/bashrc". I think this is the toplevel specifications for shell.
However, you need a root account to modify it. The local per-user specifications "~/.bashrc" should start with the following snippet, to read and load the system-level bash settings:
if [ -r /etc/bashrc ]; then . /etc/bashrc fi
I normally add aliases in the system level bashrc so that all users can access them as well. Unless they don't want to use your shortcuts and aliases.
Use the .profile file to add anything that you would add to a linux .bashrc file.
PATH=/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/:/opt/local/bin:/opt/depot_tools/:~/bin:$PATH alias t='/Users/<username>/.todo/todo.sh' alias punch='python /Users/<username>/.todo/Punch.py' alias clock='cat </dev/tcp/time.nist.gov/13' alias sudotext="sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit"
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?