Cursor Agent is not using the default shell

I’ve tried the various solutions on this forum to get the agent to use the terminal but it’s not using the default profile within cursor or the mac’s default one. I’ve tried various solutions across the forums to no avail.

Hey, what solutions have you already tried? And what shell does Composer use, and which one is your default?

Would also love to know how to setup the shell path for the agent.

I tried using the suggestions to set my default shell within the VSCode settings. My default one there is set to my system zsh shell. If I invoke it within the Cursor terminal, I have my normal packages like Node, etc. anything I’ve installed outside of Cursor. Composer says it uses zsh too but it cannot access any of the things I’ve installed in my normal zsh shell. Is there a way I can compare them easily?

I asked composer to compare the terminals:

Let me compare the two shell environments in detail:

  • Common Characteristics:

  • Both use /bin/zsh as shell

  • Both use xterm-256color terminal type

  • Both run under user tusharchopra

  • Both have same encoding and locale settings

  1. Key Differences:
  • TTY:

  • Your terminal: /dev/ttys002

  • Cursor shell: /dev/ttys008

  • PID:

  • Your terminal: 17682

  • Cursor shell: 26541

  • Shell Version:

  • Your terminal: ZSH 5.9

  • Cursor shell: Version not explicitly shown

  • Additional Environment in Your Terminal:

  • Oh My Zsh configuration: ZSH=/Users/tusharchopra/.oh-my-zsh

  • Conda setup: CONDA_EXE, CONDA_PYTHON_EXE

  • NVM (Node Version Manager): NVM_DIR, NVM_CD_FLAGS

  • Homebrew configuration: HOMEBREW_CELLAR, HOMEBREW_PREFIX

  • Custom color settings: LSCOLORS, LS_COLORS

  • PowerLine9k settings: P9K_SSH, P9K_TTY

  • PNPM configuration: PNPM_HOME

  1. Cursor-Specific Environment:
  • Git integration through Cursor

  • VSCode/Cursor specific variables

  • More limited PATH variable

  • No shell customization tools visible

That’s strange. Does this also happen in a new session? Can you reproduce it? What responses does the model give, and what questions are you asking it? Can you share screenshots if possible?

@tchopra17

Hello, I also encountered a similar problem.

When I checked the shell that the cursor agent was using, I found:

> echo $SHELL
/bin/zsh
> echo $0
/opt/homebrew/bin/bash

Oh, that’s strange. For some reason, bash was being executed.

In my case, installing direnv via Homebrew installed Homebrew’s version of bash, and for some reason, it took precedence.

I’m not sure what the root cause was, but running

brew uninstall --ignore-dependencies bash

resolved the issue.

It happens in every session, persisting through reboots, updates, etc. I’m asking it do basic things like perform migrations, run tests and analyze results, install packages. In this image you can see it trying to run the various commands. Each of those commands are available in my regular shell env.

interestingly echo $0 is giving me bash as well, but the brew command you posted doesn’t work for me. will try to identify why this is happening. thanks!