3

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 administrator@bromine.org'

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)?

  • Can you identify a reproducible way to get a bash that doesn't have the aliases? When this happens, what does ps -p $$ -p $PPID show? – Gilles Apr 1 '12 at 17:28
  • 4
    Have you tried sourcing with the full path, i.e. ${HOME}/.bashrc instead of .bashrc? – kopischke Apr 11 '12 at 17:16
  • I had similar issues a long time ago. I simply mashed everything into .profile, removed .bashrc and .bash_profile, and stopped having issues. – kccricket Jul 5 '12 at 18:55
  • Thanks, I'll give that a shot and see if loading the aliases becomes more reliable. – David Faux Jul 7 '12 at 7:50
  • How do you startup? – user151019 Nov 2 '13 at 9:43
4

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.

  • That might be a fix but why has this happened that seems a nasty bug. What else is broken – user151019 Nov 2 '13 at 9:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .