I’m encountering an issue while using the Cursor Agent in my development environment on macOS. My default shell is set to zsh (configured with oh-my-zsh), but the Agent seems to be executing commands in a different shell.
As a result, commands like node and python, which are installed on my system and work perfectly fine in my terminal, fail to execute with the error: command not found.
I’ve double-checked my configurations, and the default shell for my system is indeed zsh.
Does anyone know how to ensure the Cursor Agent uses the default zsh shell for executing commands? Any help would be greatly appreciated!
I’m facing the same issue. It cannot find any command even though I can find it through the regular VS Code terminal.
The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh.
For more details, please visit Use zsh as the default shell on your Mac - Apple Support.
Tushars-MacBook-Pro:ctf tusharchopra$ pnpm dlx shadcn-ui@latest add select
bash: pnpm: command not found
Tushars-MacBook-Pro:ctf tusharchopra$ npm install -g pnpm
bash: npm: command not found
I was facing the same issue. I installed fish-terminal, and all of a sudden Cursor started using fish. I uninstalled fish, and now it’s defaulting to bash, and still is not using zsh.
In my settings.json file, I have "terminal.integrated.defaultProfile.osx": "zsh", and the issue remains.
I ask the agent to run a simple “ls” command and pop out the terminal. This is the process and terminal information.
(text in the photo transcribed)
ls
Process ID (PID): 20547
Command line: /opt/homebrew/bin/bash '--init-file' '/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh'
Shell integration activated
The following extensions have contributed to this terminal's environment:
* Git : Enables the following features: git auth provider
* Python : Activated environment for ./.venv/bin/python
Show Environment Contributions
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.
I had a similar issue where Cursor couldn’t find things that perfectly works in my terminal.
In my case, I use bash but Cursor was trying to use zsh which doesn’t have all the alias, path, helpers…
(here lago is a docker composer command alias)
julien@Juliens-MacBook-Pro api % lago exec api bin/rails about
zsh: command not found: lago
I finally managed to make it work with this config:
Can confirm this does fix it on macOS Sequoia (15.6). Thanks for sharing
Edit: Scrap that spoke to soon. It works sometimes , but most of the time is still unable to see terminal output. It can run a command, but cannot see the response.
This really needs to make its way into some official docs, it’s pretty poor on Cursors part that they aren’t detecting the default shell setup, zsh is very widely used amongst devs on macos.