Having issues with PowerShell. MacBook Apple Silicon

On my Mackbook Pro Max 16 2023
I am getting errors from Composer. this happens when it wants to execute a command on the CLI.

I am not sure why this is happening. I did install xcode and wondering if this caused something to break. Please let me know.

Exception

System.InvalidOperationException: Cannot locate the offset in the rendered text that was pointed by the origi
nal cursor. Initial Coord: (42, 18) Buffer: (109, 19) Cursor: (43, 0)
at Microsoft.PowerShell.PSConsoleReadLine.RecomputeInitialCoords(Boolean isTextBufferUnchanged)
at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(PSKeyInfo key, Dictionary2 dispatchTable, Boolean ignoreIfNoAction, Object arg) at Microsoft.PowerShell.PSConsoleReadLine.InputLoop() at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, C ancellationToken cancellationToken, Nullable1 lastRunStatus)

1 Like

Hey, can you send a screenshot of how this error presents to you?

1 Like

I am not sure why it is trying to use powershell.

Environment:

  • OS: macOS (darwin 24.2.0)
  • System Shell: zsh (/usr/local/bin/zsh)
  • Component: AI Assistant’s run_terminal_cmd tool
  • IDE: Cursor

Version: 0.45.4
VSCode Version: 1.96.2
Commit: d9f8a232158c173cb84b31a70a49a9689bf0f770
Date: 2025-01-26T07:23:35.719Z (3 days ago)
Electron: 32.2.6
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Darwin arm64 24.2.0

Shell zsh

Issue: Cursor IDE’s run_terminal_cmd Tool Defaults to PowerShell on macOS Despite System Shell Being zsh

When the AI Assistant (Claude) attempts to execute commands using the run_terminal_cmd tool, it incorrectly defaults to PowerShell despite the system being configured to use zsh. This creates issues when running shell-dependent commands and scripts.

Steps to Reproduce:

  • Open Cursor IDE on macOS
  • Verify system shell is zsh (echo $SHELL returns /usr/local/bin/zsh)
  • Ask the AI Assistant to execute a command using run_terminal_cmd
  • Observe the command execution output

Expected Behavior:

The run_terminal_cmd tool should respect the system’s default shell (zsh) when executing commands on macOS.

1 Like

Technical Details:

  1. The tool appears to be hardcoded to use PowerShell’s PSReadLine (version 2.3.4) and PowerShell Core (version 7.4.0)

  2. This occurs even when the system’s default shell is explicitly set to zsh

  3. Attempts to force zsh using /bin/zsh -c still show PowerShell initialization, suggesting the tool is wrapping all commands in a PowerShell context

  4. The issue persists despite proper zsh configuration in the user’s environment:

  • Properly configured .zshrc with conda initialization

  • Valid shell environment variables

  • Correct PATH configurations

Impact on Conda Usage:

The PowerShell wrapping is particularly problematic for conda environments because:

  1. Conda’s shell initialization is specifically configured for zsh in the user’s .zshrc

  2. The PowerShell wrapper prevents proper conda environment activation

  3. Environment variables and PATH modifications made by conda aren’t properly propagated

1 Like

You should be able to add to your AI rules which terminal you want it to use and see if that helps.

If not let me know, we may need to add an option to choose the default terminal for the Composer agent!

Where do I add the rule for this and what should I say in that rule?

I’m having similar issues. I thought it was because I had PowerShell installed on my MBP, so I removed it and the VSCode Poweshell extension, but it didn’t solve the issue.

Adding the following to the Rules for AI field in the Cursor Settings seems to help; it now always opens a new terminal pane and runs the commands there.

Always use the default OS terminal over Powershell for running commands, except if it’s on a Windows machine

But it would be nice if it did that in the Cursor agent instead of the new terminal pane.

Can you give this a try:

Yup, that worked on my M1 MacBook. I was also able to get it to stop asking me to install PowerShell on my Ubuntu workstation using a similar set of settings

"terminal.integrated.automationProfile.linux": {},
"terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.shellIntegration.enabled": false

Where is the settings.json file?

Sorry I am a little lost.

I can see that it is trying to start this:

"/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1"'

Every time. I clicked the settings ICON and in the AI RULES added:

- Always use the default OS terminal over Powershell for running commands, except if it’s on a Windows machine

"terminal.integrated.automationProfile.linux": {},
"terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.shellIntegration.enabled": false

Is this not right?

Thank you for your help.
-J

Yup, that worked on my M1 MacBook. I was also able to get it to stop asking me to install PowerShell on my Ubuntu workstation using a similar set of settings

Circling back here, while it does seem to work, it runs a different terminal from my OS terminal. So I have node v 20 installed on my OS, but the version running in Cursor is only 16

On my MacBook it’s located in /Users/myusername/Library/Application Support/Cursor/User/settings.json