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 check what slows down my terminal startup? I'm using zsh with ohmyzsh on iTerm2.

It takes about 10 second to open a new window :(

This is my zshrc file:

export PATH=/usr/local/mysql/bin:$PATH
export PATH=$HOME/bin:$PATH
export PATH=$PATH:/usr/local/git/bin/
export HISTFILESIZE=5000
export PYTHONPATH="/usr/local/lib/python2.7/site-packages/:$PYTHONPATH"
#alias ls="ls -G"

export NODE_PATH="/usr/local/lib/node"
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/share/npm/bin:$PATH"

#svndiff() {
#    svn diff $1 | colordiff.pl
#}

#hgdiff() {
#    hg diff $1 | colordiff.pl
#}
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh

#PS1="$prompt_style"'${debian_chroot:+($debian_chroot)}\u@\h:\W\$'"$command_style "
#trap 'echo -ne "\033[00m"' DEBUG

export LANG="it_IT.UTF-8"
export LC_COLLATE="it_IT.UTF-8"
export LC_CTYPE="it_IT.UTF-8"
export LC_MESSAGES="it_IT.UTF-8"
export LC_MONETARY="it_IT.UTF-8"
export LC_NUMERIC="it_IT.UTF-8"
export LC_TIME="it_IT.UTF-8"
export LC_ALL=

#export CURL_CA_BUNDLE="$HOME/.curl/cacert.pem"

#Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="cypher"

# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"

# Comment this out to disable weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"

# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"

# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(fab osx pip django)

source $ZSH/oh-my-zsh.sh

# Customize to your needs...
export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/share/npm/bin:/Users/patrick/bin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin/:$PATH

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function


alias serve="python -m SimpleHTTPServer"

alias adb="~/Documents/android-sdk-macosx/platform-tools/adb"
alias fastboot="~/Documents/android-sdk-macosx/platform-tools/fastboot"

Yeah, there's a lot of stuff, can you help me to check which is the cause of the problem?

Thanks :)

share|improve this question
    
for me it turned out that virtualenvwrapper was causing the big delay. – Ioannis Filippidis Sep 8 '14 at 23:31
1  
yes, virtualenvwrapper is quite slow, by the way there is virtualenvwrapper_lazy which doesn't slow the terminal startup :) – patrick Sep 9 '14 at 8:00
    
I ended up adding alias loadvw="source /Users/me/Library/Python/2.7/bin/virtualenvwrapper.sh"; workonenv(){source ~/.virtualenvs/$1/bin/activate} to my ~/.bashrc, because workon is essentially the only missing everyday command (deactivate becomes available after activation), unless you create and delete envs every day. – Ioannis Filippidis Sep 9 '14 at 8:17
up vote 2 down vote accepted

Have you tried removing the Apple System Logs?

http://ariejan.net/2011/11/08/fixing-a-slow-starting-terminal-or-iterm2-on-mac-os-x/

If that doesn't fix it, move your zshrc aside with mv .zshrc zshrc.testing and if that makes it faster comment out every line and slowly uncomment lines one at a time until you see what is slowing it down.

share|improve this answer
    
Already removed the logs. I'll try commenting the lines :) Thanks – patrick Jul 6 '12 at 18:31

With iTerm2, you can trace initialization by setting

Preferences -> Profiles -> [Your Profile, or Default] -> General -> Command

from "Login Shell". To:

/bin/zsh -i -x

The -x will show the commands .zshrc (and /etc/profile) are running prior to showing the prompt.

Using iTerm2 logging you can log each command with the time it ran, and get a general idea of what is taking the bulk of the time.

share|improve this answer

You must log in to answer this question.

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