When I have Terminal.app open for some time (mostly after 2-3 hours), everything starts getting slow. When I type there is a delay for each character, and all applications lag when I scroll. If I restart Terminal, it goes away and my mac is quick and snappy again. But the problems comes back after some hours. It's especially bad when I have a ssh connection open to one of my servers.
I use Terminal a lot (I'm a developer), so it bothers me to have to restart it.
Do you have any idea how to find the problem? I can't find anything about this when googling.
I'll attach some screenshots from Activity Monitor, taken while it happens, just incase it helps.
My machine: Retina MacBook Pro, 2.6 GHz Intel Core i7, 16 GB RAM.
UPDATE 1
Content of my bash startup files:
/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
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
/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
~/.bash_profile:
export PATH=/usr/local/bin:$PATH
export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
~/.bash_login: I don't have this file
~/.profile:
export JAVA_HOME=/Library/Java/Home
export CLICOLOR=1
export LSCOLORS=exfxcxdxbxegedabagacad
# MacPorts Installer addition on 2012-10-02_at_22:35:07: 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.
homebrew=/usr/local/bin:/usr/local/sbin
export PATH=$homebrew:$PATH
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
~/.bashrc:
mygrants() {
mysql -B -N $@ -e "SELECT DISTINCT CONCAT(
'SHOW GRANTS FOR \'', user, '\'@\'', host, '\';'
) AS query FROM mysql.user" | \
mysql $@ | \
sed 's/\(GRANT .*\)/\1;/;s/^\(Grants for .*\)/## \1 ##/;/##/{x;p;x;}'
}