How to Fix Cursor Agent Not Using Default zsh Shell on macOS?

Still can’t get cursor to pick up those settings. A hacky but effective workaround is to make bash automatically exec into zsh when it’s launched by Cursor’s Agent.

You can detect this because Cursor sets an environment variable: CURSOR_TRACE_ID.

Add this to your ~/.bash_profile (or ~/.bashrc if that’s what’s being sourced):

if [ -n "$CURSOR_TRACE_ID" ] && [ -z "$BASH_TO_ZSH" ]; then
  export BASH_TO_ZSH=1
  exec zsh
fi

Why this works:

  • CURSOR_TRACE_ID is set by Cursor Agent sessions, not by your normal terminal.
  • exec zsh -l replaces the current bash process with a login zsh shell.
  • The BASH_TO_ZSH guard prevents infinite loops in case zsh also calls back into bash somehow.