Sphere
Log in Join
☆ 5

oh-my-zsh shell takes two seconds to start after adding plugins

macOS Sonoma, zsh 5.9, oh-my-zsh with powerlevel10k. Shell startup went from instant to about two seconds after I added a few plugins — git, docker, kubectl, pyenv. time zsh -i -c exit confirms it. Which plugins are usually the slowest and how do I actually profile this? I'd rather not guess and delete things randomly. time zsh -i -c exit gives about 1.9 seconds consistently, and a plain zsh -c exit is basically instant, so it's definitely something in the interactive startup files.

⚑ Report

4 replies

☆ 0
F ferret ·2026-10-13#1

zsh -x traces startup — run zsh -x -i -c exit 2> /tmp/zsh.log and look at the timing between lines. pyenv init is almost always the slow one, especially pyenv init -. kubectl completion can be slow too. That'll tell you for sure instead of guessing.

⚑ Report
☆ 0
A async ·2026-10-22#2

It's pyenv — pyenv init - takes 1.2 seconds on its own. Can I lazy-load it somehow? I do need pyenv for a few projects but not for every shell I open. Most of my work is on a system Python so paying that cost every time is silly.

⚑ Report
☆ 0
K kernel ·2026-10-24#3

Yes. Use pyenv init --path in .zprofile so it runs once at login, and only eval "$(pyenv init -)" lazily when you actually invoke pyenv. powerlevel10k has an instant prompt feature that hides the remaining delay too, which makes the shell feel instant.

⚑ Report
☆ 0
I inode ·2026-10-29#4

Also remove plugins you don't use daily — each one sources a file on startup. The docker and kubectl plugins can be replaced with lazy completion loaded on first command. If you want to get serious about it, zgenom or sheldon handle this more cleanly than oh-my-zsh.

⚑ Report
Log in to reply.