Terminal spawned by AI doesn't source shell initialization files (~/.zshrc)

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

In short, terminal commands stopped working after switching from Claude-4.5 to GPT-5 (persists even after switching back)

Terminal commands (like rvm ls, nvm ls) worked perfectly until a few days ago when I decided to switch to model GPT-5, then immediately started failing with errors like parameter not set or not finding Rails. Switching back to Claude-4.5 didn’t fix it - the issue persists regardless switching back or any other model. It looks like something got corrupted/messed up when I switched to GPT-5

Based on Claude-4.5 investigation, the terminal now spawns in non-interactive mode and doesn’t source shell initialization files (~/.zshrc), breaking version managers (RVM, nvm, asdf) and other tools.
Commands work fine in iTerm but fail when run by the AI.

Steps to Reproduce

I just ask the agent run any command that requires rvm being initialized

Expected Behavior

Terminal should work as it did before the model switch.

Screenshots / Screen Recordings

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 1.6.45
VSCode Version: 1.99.3
Commit: 3ccce8f55d8cca49f6d28b491a844c699b8719a0
Date: 2025-09-22T18:22:38.013Z
Electron: 34.5.8
Chromium: 132.0.6834.210
Node.js: 20.19.1
V8: 13.2.152.41-electron.0
OS: Darwin arm64 24.2.0

For AI issues: which model did you use?

Claude-4.5-sonnet → gpt-5

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

Disclaimer: I tested very briefly and chat Claude said is true - .zshrc isn’t run by the Agent spawned terminal. I don’t know if it would happen previously or not tho.

HOWEVER, I do know what everything started to stop working (after 7 months of daily Cursor usage) as soon as I switched the model to gpt-5 and never again worked. So something on the model switch caused a bug on my end

Hey, thanks for the report. This is definitely a weird one - the model switch shouldn’t affect how terminals are spawned, but I understand how frustrating this must be after 7 months of smooth usage

The issue you’re describing where the AI-spawned terminal doesn’t source .zshrc is actually expected behavior - Cursor’s AI runs commands in non-interactive shells by default, which don’t load your shell initialization files. This is why tools like rvm, nvm, and asdf aren’t available

A few things to try:

  1. Source your shell file explicitly - you can ask the AI to run source ~/.zshrc && your_command

  2. Check your Cursor terminal settings - go to Settings → Terminal and make sure your shell is set correctly

  3. Try the workaround - some users add their PATH exports to .zprofile instead of .zshrc since that gets loaded in non-interactive shells

The timing with the GPT-5 switch is probably coincidental - maybe something else changed in your setup around the same time?

Let me know if sourcing the shell file manually works for now

Heyo, thanks for chiming in and trying to help!

This is why tools like rvm, nvm, and asdf aren’t available

First of all, I quickly checked and VsCode runs rvm commands just fine - I guess it may be bc it’s not a background spawned terminal or smth like that (?)

Then, I noticed that nvm DOES work on Cursor (the node one)

By now I’m completely hopeless to find a fix to be honest… I tried all of your suggestions and nothing worked :frowning:
This is the last thing I tried - and failed:

If this can’t be fixed I guess I’ll need to spend some time checking if I can migrate back to VsCode since I can’t afford wasting time dealing with Cursor issues/corruption overnight

Try enabling the new “Legacy Terminal Tool” setting, it might help.

Before giving up I decided to do one final test: reinstall rvm.
I completely wiped it out, deleted all traces and references to rvm in dotfiles and then installed rvm again… IT WORKED :tada:

This is why tools like rvm, nvm, and asdf aren’t available

This comment of yours got me ngl, and I’d say it was quite misleading bc it almost made me give up of Cursor. I don’t know how or why, but it does work :slight_smile:

Either ways, thank you so much for your help and assistance!

1 Like

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.