I’m on Mac OS X 10.10. All of the sudden, my “Terminal” started running a command whenever I open a new tab. This is frustrating because I'm used to being able to type immediately when opening a tab and having the command execute as I typed it.
For example, before this problem I could hit cmd+T and then immediately type bin/rails c
and when the tab was ready, bin/rails c
would be on the command line and I could just hit enter. Now, this is what happens:
bin/lserman-5:test lserman$ bin/cd /workspace/test/app/helpers
-bash: bin/cd: No such file or directory
lserman-5:test lserman$ rails c
The command that is run is cd /workspace/test/app/helpers
, which gets executed when I’m in the middle of typing bin/rails c
. cd
is also a pain because the terminal switches to a different directory when I’m used to having it open the tab in the same place the previous tab was at. For example, this is what I get when I just hit cmd+T without typing anything immediately:
lserman-5:test lserman$ cd /workspace/test/app/helpers
lserman-5:helpers lserman$
The actual command seems to change every couple of days. I have no idea what causes it. If I remember correctly, it seems that it's always some form of cd
. I’ve looked in .profile
, .bash_profile
, and .bashrc
and I see nothing out of the ordinary. What else can cause this to happen?
The contents of /etc/profile
:
# System-wide .profile for sh(1)
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi
The contents of /etc/bashrc
:
# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
return
fi
PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
# Tell the terminal about the working directory at each prompt.
if [ "$TERM_PROGRAM" == "Apple_Terminal" ] && [ -z "$INSIDE_EMACS" ]; then
update_terminal_cwd() {
# Identify the directory using a "file:" scheme URL,
# including the host name to disambiguate local vs.
# remote connections. Percent-escape spaces.
local SEARCH=' '
local REPLACE='%20'
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
printf '\e]7;%s\a' "$PWD_URL"
}
PROMPT_COMMAND="update_terminal_cwd; $PROMPT_COMMAND"
fi
profile
script and a global and userbash.rc
and/or.bash
script when starting the terminal.