Whenever I open a new tab in Terminal using Cmd + T, it opens bash in the same directory, as the previous tab. This works fine when I'm in the ~
directory, but if I'm anywhere else, I get an error loading .bashrc
Last login: Sat Oct 15 21:10:00 on ttys002
-bash: .bashrc: No such file or directory
Jakub-Arnolds-MacBook-Pro:projects darth$
It looks like .bashrc
is loaded via relative and not absolute path, because if I do source ~/.bashrc
, everything works smoothly.
I think this is a OS X Lion related problem, because before the upgrade from Snow Leopard, I didn't have the same issue. But that might be caused by Terminal always opening at ~
, I don't remember if it tried to open the same directory.
However the question remains the same, how can I make Terminal load ~/.bashrc
via absolute path, and not relative?
I have the following in my ~/.bash_profile
:
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
If I had .bashrc
instead of ~/.bashrc
, I'd be seeing the same symptom you're seeing.
Renaming .bashrc
to .profile
(or soft-linking the latter to the former) should also do the trick. See here.
Source: Stackoverflow.com