Why don't my aliases in .bashrc work?
I have Lion on my Mac Air. I wrote some aliases in ~/.bashrc file, which looks like:
# Aliases
alias p='pdflatex *.tex;open *.pdf'
alias bromine='ssh [email protected]'
I then sourced my .bashrc file from .bash_profile, which I believe is sourced upon startup. My .bash_profile file looks like
# Setting PATH for EPD-7.2-2
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
export PATH
MKL_NUM_THREADS=1
export MKL_NUM_THREADS
# MacPorts Installer addition on 2012-02-27_at_18:19:09: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
# source bashrc
. .bashrc
Why is it that my aliases work sometimes upon startup, but not always - (sometimes, I have to manually source .bash_profile)?
It seems like your bash shell is looking for .profile
instead of .bashrc
. What you can do is make a symbolic link:
ln -s ~/.bashrc ~/.profile
and restart your session (close, reopen Terminal). Any future bash setting updates can be made to .profile
or .bashrc
.