I have an alias that I've added to .bashrc, and it only activates in Terminal after I run the 'bash' command. I feel like I should know what's happening here, but I don't. :)
Depending on the version of OS X you are using your default shell might not be bash. You can verify this by typing(before you run 'bash'):
$ echo $SHELL /bin/zsh
You can change your default shell to bash so you don't have to keep running the command by following the instructions here:
for <=10.4 - netinfo manager, /users/whoever/shell
for 10.5=> - SysPrefs, accounts, control-click on user, select advanced options, edit login shell field.
To further answer your question, the .bashrc is only used by the bash shell. If you want you can figure out what shell you are using and add the alias to the .tcshrc or .zshrc instead of changing everything to use bash.
More info on what a shell is:
and bash specifically:
When an interactive shell that is not a login shell is started, bash reads and executes commands from
~/.bashrc, if that file exists.
On OS X, all Terminal windows and tabs run login shells, which is equivalent to you running
bash --login instead of
~/.bashrc is therefore ignored, unless explicitely
sourced from e.g.
When bash is invoked as an interactive login shell, [...] it first reads and executes commands from the file
/etc/profile, if that file exists. After reading that file, it looks for
~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.
~/.bash_profile if it doesn't exist, and add the following line:
.bashrc will be loaded even for login sessions.
The alias doesn't work after you run
bash - it works while you're running
~/.bashrc is a file that contains directives that are run by
bash every time it's started. The default shell for all recent versions of Mac OS X is
bash, so it's run every time you open a Terminal.
bash does not, however, magically know to re-read its configuration files when you edit them, so the alias doesn't immediately work when you add it to
~/.bashrc. What you do when you run
bash in your existing shell is create another instance of
bash (which will read the modified configuration file, because it's starting up). Note that your original instance of
bash is still there, running behind the
bash you ran manually. If you close the shell (with the
exit command) you'll return to your original shell (if you close it, you'll get a "process completed" message from the terminal).
So, to get back to your problem: your alias won't work until
bash re-reads its configuration. You can do this by starting
bash again (either by creating another shell inside your existing shell by running
bash, or by closing and opening your terminal) or, you can use the
source command to get
bash to re-read a file. So, after you've edited
source ~/.bashrc - alias working, no starting