Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to verbosely print everything that gets executed when I open a Terminal in OS X?

Sometimes it takes up to 10 seconds for the Terminal to become ready for interaction and I want to know what's causing this.

Most likely it is something in one of my dot files or as someone had suggested it could be a DNS related issue but either way I want to know the reason for this random slowness and fix it.

Any suggestions?

share|improve this question
up vote 0 down vote accepted

Assuming you are using bash, put

set -x

in all of your shell startup files. This shell option prints every command that is executed, post-expansion.

share|improve this answer

If you want to check the time it takes for your shell to source your dotfiles, you can just time their execution.

time . ~/.bash_profile

Rinse and repeat for .profile (if you use that instead of .bash_profile), .bashrc (if you source this from .bash_profile*), et cetera. Otherwise, I don't think any system configuration file should be responsible for that.

I've personally found bash_completion to take rather long (~300ms) – in my case, this part consumes most of the time it takes up to source my .bash_profile.

* .bashrc isn't sourced automatically for new Terminal sessions in OS X, so you'd have to manually specify that anyway.

share|improve this answer

You must log in to answer this question.

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