Help me determine what runs when I open a new Terminal window I noticed that when I started a Terminal window by accident and tried to close it quickly by pressing the X on the window, I got a dialog box like this:

"Closing this window will terminate the running processes: login, bash, bash, perl."


My computer was under heavy load at the time and slow. I hit cancel, and tried it again, it closed quietly.

This leads me to believe that there is a Perl script loading every-time I start up my terminal. I have been unable to re-create the issue so far. How I can check exactly what scripts are being run when I open the Terminal?

1 /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 ] &amp;&amp; . /etc/bashrc
fi

2 ~/.profile
(just user defined aliases)

3 ~/.bash_profile

    # Setting PATH for MacPython 2.5
    # The orginal version is saved in .bash_profile.pysave
    PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
    export PATH

    test -r /sw/bin/init.sh &amp;&amp; . /sw/bin/init.sh

    ##
    # Your previous /Users/USERNAME/.bash_profile file was backed up as /Users/USERNAME/.bash_profile.macports-saved_2010-04-04_at_17:07:45
    ##

    # MacPorts Installer addition on 2010-04-04_at_17:07:45: 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.


    # MacPorts Installer addition on 2010-04-04_at_17:07:45: adding an appropriate MANPATH variable for use with MacPorts.
    export MANPATH=/opt/local/share/man:$MANPATH
    # Finished adapting your MANPATH environment variable for use with MacPorts.

#Add Some Color to "ls"
    export CLICOLOR=1
    export LSCOLORS=ExFxCxDxBxegedabagacad

    ##
    # Your previous /Users/USERNAME/.bash_profile file was backed up as /Users/USERNAME/.bash_profile.macports-saved_2011-09-23_at_23:15:01
    ##

    # MacPorts Installer addition on 2011-09-23_at_23:15:01: 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.

    # My Aliases
    (REMOVED ALIASES)

    4 ~/.bashrc
(FILE DOESN'T EXIST)
At startup bash executes (in that order)


/etc/profile
~/.profile
~/.bash_profile
~/.bashrc


So any unexpected code should be called from one of these scripts (or a script called from one of them etc.).