[BUG] Claude code unusable on MacOS, can't run any bash command

Resolved 💬 18 comments Opened Jul 3, 2025 by svallory Closed Feb 27, 2026
💡 Likely answer: A maintainer (ant-kurt, collaborator) responded on this thread — see the highlighted reply below.

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: All latest versions (for each install mode) tried. Currently on 1.0.38 native
  • Operating System: macOS Sonoma 14.7.4 (23H420)
  • Terminal: iTerm2 and Terminal
  • shell: tried on ZSH and Bash

Bug Description

I cannot run

Steps to Reproduce

  1. Start claude code
  2. run ! ls or ask Claude to run it

Expected Behavior

Command runs

Actual Behavior

Command times out in 2 minutes

Additional Context

Settings:

{
  "permissions": {
    "allow": [
      "Bash",
      "Bash(*)",
      "Bash(*:*)"
    ],
    "deny": []
  }
}

View original on GitHub ↗

18 Comments

ant-kurt collaborator · 1 year ago

Hi @svallory - can you try running with env var ANTHROPIC_LOG=debug, and see if there are failing calls to the small, fast model? There's a preflight check that needs to pass before bash commands will execute.

Related https://github.com/anthropics/claude-code/issues/1378#issuecomment-2941753236

svallory · 1 year ago

Hi @ant-kurt here's what I see:

FYI: I ended up creating a Ubuntu virtual machine and connecting cursor to it via SSH. Claude code runs fine in there, so it looks like the issue is related to something on my environment. The problem is that the logs don't give me a clue of what it may be.

Wild guess: cat is an alias for bat with automatic paging, so calling it would never finish. In fact, I have many commands aliased.


! ls
  ⎿  [feat/rcl-2 1f9652a] WIP
      Date: Fri Jul 11 03:15:07 2025 -0300
      13 files changed, 1139 insertions(+), 2 deletions(-)
      create mode 100644 .vscode-test.mjs
      create mode 100644 .vscodeignore
      create mode 100644 CHANGELOG.md
      create mode 100644 esbuild.js
      create mode 100644 eslint.config.mjs
      create mode 100644 examples/flows/BMW FLOW.pdf
      create mode 100644 examples/flows/BMW Texts (1).docx
      create mode 100644 examples/flows/BMW Texts (1).docx.md
      create mode 100644 src/extension.ts
      create mode 100644 src/test/extension.test.ts
      create mode 100644 vsc-extension-quickstart.md
     [feat/rcl-2 396de89] WIP
      Date: Fri Jul 11 03:15:07 2025 -0300
      13 files changed, 1139 insertions(+), 2 deletions(-)
      create mode 100644 .vscode-test.mjs
      create mode 100644 .vscodeignore
      create mode 100644 CHANGELOG.md
      create mode 100644 esbuild.js
      create mode 100644 eslint.config.mjs
      create mode 100644 examples/flows/BMW FLOW.pdf
      create mode 100644 examples/flows/BMW Texts (1).docx
      create mode 100644 examples/flows/BMW Texts (1).docx.md
      create mode 100644 src/extension.ts
      create mode 100644 src/test/extension.test.ts
      create mode 100644 vsc-extension-quickstart.md

  ⎿  Command timed out after 2m 0.0s Nothing specified, nothing added.
     hint: Maybe you wanted to say 'git add .'?
     hint: Disable this message with "git config set advice.addEmptyPathspec false"
     [ WARN 2025-07-14 13:26:08.613] moon_workspace::projects_locator  Received a file path for a project root, must be a directory
     source="/work/rcs/temp/rcl/apps/README.md"
     [ WARN 13:26:08.613] moon_workspace::projects_locator  Received a file path for a project root, must be a directory
     source="/work/rcs/temp/rcl/libs/README.md"
     [ WARN 13:26:08.613] moon_workspace::projects_locator  Received a file path for a project root, must be a directory
     source="/work/rcs/temp/rcl/packages/README.md"

     │ CAUTION
     │ Target(s) :lint, :format not affected by touched files using status staged

     [ WARN 2025-07-14 13:26:09.511] moon_workspace::projects_locator  Received a file path for a project root, must be a directory
     source="/work/rcs/temp/rcl/apps/README.md"
     [ WARN 13:26:09.511] moon_workspace::projects_locator  Received a file path for a project root, must be a directory
     source="/work/rcs/temp/rcl/libs/README.md"
     [ WARN 13:26:09.512] moon_workspace::projects_locator  Received a file path for a project root, must be a directory
     source="/work/rcs/temp/rcl/packages/README.md"

     │ CAUTION
     │ Target(s) :lint, :format not affected by touched files using status staged

     _arguments:comparguments:327: can only be called from completion function
[log_cb652a] sending request {
  method: 'post',
  url: 'https://api.anthropic.com/v1/messages?beta=true',
  options: {
    method: 'post',
    path: '/v1/messages?beta=true',
    body: {
      model: 'claude-3-5-haiku-20241022',
      max_tokens: 512,
      messages: [Array],
      system: [Array],
      temperature: 0,
      metadata: [Object],
      stream: true
    },
    timeout: 60000,
    signal: AbortSignal {},
    stream: true
  },
  headers: {
    accept: 'application/json',
    'anthropic-beta': 'oauth-2025-04-20,fine-grained-tool-streaming-2025-05-14',
    'anthropic-dangerous-direct-browser-access': 'true',
    'anthropic-version': '2023-06-01',
    authorization: '***',
    'content-type': 'application/json',
    'user-agent': 'claude-cli/1.0.51 (external, cli)',
    'x-app': 'cli',
    'x-stainless-arch': 'arm64',
    'x-stainless-helper-method': 'stream',
    'x-stainless-lang': 'js',
    'x-stainless-os': 'MacOS',
    'x-stainless-package-version': '0.55.1',
    'x-stainless-retry-count': '0',
    'x-stainless-runtime': 'node',
    'x-stainless-runtime-version': 'v22.6.0',
    'x-stainless-timeout': '60'
  }
}
[log_cb652a, request-id: "req_011CR7CcsMTx59QHUUq9rEjk"] post https://api.anthropic.com/v1/messages?beta=true succeeded with status 200 in 1700ms
[log_cb652a] response start {
  url: 'https://api.anthropic.com/v1/messages?beta=true',
  status: 200,
  headers: {
    'anthropic-organization-id': 'c6a64ead-09d3-4a84-bb7d-0e7f3c98f972',
    'anthropic-ratelimit-unified-fallback-percentage': '0.5',
    'anthropic-ratelimit-unified-representative-claim': 'five_hour',
    'anthropic-ratelimit-unified-reset': '1752526800',
    'anthropic-ratelimit-unified-status': 'allowed',
    'cache-control': 'no-cache',
    'cf-cache-status': 'DYNAMIC',
    'cf-ray': '95f248079b17e018-GIG',
    connection: 'keep-alive',
    'content-type': 'text/event-stream; charset=utf-8',
    date: 'Mon, 14 Jul 2025 16:08:55 GMT',
    'request-id': 'req_011CR7CcsMTx59QHUUq9rEjk',
    server: 'cloudflare',
    'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
    'transfer-encoding': 'chunked',
    via: '1.1 google',
    'x-robots-tag': 'none'
  },
  durationMs: 1700
}
response 200 https://api.anthropic.com/v1/messages?beta=true Headers {} ReadableStream {}
[log_cb652a] response parsed {
  url: 'https://api.anthropic.com/v1/messages?beta=true',
  status: 200,
  body: vF {
    iterator: [AsyncGeneratorFunction: D],
    controller: AbortController {}
  },
  durationMs: 1701
}
svallory · 1 year ago

It is very likely an issue caused by an alias to some command. I just tried running claude code as another user and commands worked again.

UPDATE: nevermind, I removed all the aliases from my user's env and the issue persists

jmanchuck · 11 months ago

I had similar issue and for me it was because claude code was using zsh (using the SHELL environment variable)

When I ran claude with

``SHELL=/bin/bash claude``

the commands work again.

Is Claude Code hard coded to use bash shell commands? Maybe it should always use /bin/bash instead of what's in SHELL

ngzax · 11 months ago

was having the same issue. SHELL=/bin/bash claude fixed this for me.

Lap1n · 10 months ago

SHELL=/bin/bash claude doesn't fix the issue on my side. Also, this only affect MacOS, it works fine on my linux computer.

Plumillon · 9 months ago

Having the same issue here.
I tried with SHELL=/bin/bash claude without success.

moranet2-dev · 9 months ago

Having same problem in MacOS. I'm swearing hard

mcarlson · 9 months ago

I am also hitting this, not sure how to work around it...

rustyrazorblade · 9 months ago

On at least a few occasions, I checked /context and found I had hit the limit of the window. GitHub alone was using 100K tokens. I had some calls to MCP servers fail as well, and I think the cause of that was Claude's client timing out.

John-Paul-R · 7 months ago

I just newly encountered this issue on the native claude code cli on arch linux

https://github.com/anthropics/claude-code/issues/2958#issuecomment-3164443934

SHELL=/bin/bash

did resolve the issue for me.

I've been running in zsh for as long as I've used claude, interestingly.

github-actions[bot] · 6 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

John-Paul-R · 6 months ago

I am still encountering this issue on claude code 2.0.76 on linux 6.18.2-arch2-1 in zsh.

Edit:

SHELL=/bin/bash does continue to alleviate the issue in my case.

charphob · 6 months ago

I am experiencing the same issues, 2.0.75 on macos. Using ZSH, the SHELL=/bin/bash does not work.

adaviscourt · 6 months ago

Same issue, M1 Pro with macOS 15.6.1, Claude 2.1.0, SHELL=/bin/bash does not work.

Edit: ironically, claude was able to figure out the reason:

I found the issue in your .bash_profile file. Look at line 1:

bash

This line is launching a nested bash shell every time bash starts. When Claude Code tries to run a bash command, it:

1. Starts bash
2. Sources .bash_profile
3. Encounters bash on line 1
4. Tries to start another bash (which sources .bash_profile again)
5. This creates a recursive loop or nested shells

This is why all bash commands hang and eventually get killed with SIGKILL (exit code 137).

Solution

Remove line 1 from your .bash_profile file. The line that just says bash should be deleted

Not sure why I had that there in the first place, but after removal, bash commands are running just fine.

randykerber · 5 months ago

Related issue 19663. Still occurs in Claude Code v2.1.19, on latest macOS.

Bash Tool Returns No Output on macOS

github-actions[bot] · 4 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

github-actions[bot] · 4 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.