Command failed with exit code 5: bundle install error Shopify Cli CMD

Topic summary

Shopify CLI commands fail locally with “Command failed with exit code 5: bundle install,” blocking theme development. Screenshots of the error were attached. “bundle install” is the Ruby dependency installer used by the CLI.

Tried and mixed results:

  • Running CMD/VS Code as Administrator did not help for several users.
  • On macOS, updating Homebrew and reinstalling Xcode Command Line Tools resolved the issue for one user.

Key Windows 10 resolution reported:

  • A bug in Shopify CLI v3.60.1 caused the failure. Uninstalling the CLI and installing an older version (v3.51.1) fixed it: uninstall @shopify/cli and @shopify/theme globally, then install v3.51.1 of both.

Other potential cause:

  • Windows username path containing spaces (e.g., C:\Users\First Last) broke paths; using a username without spaces resolved it for one user.

Status and open questions:

  • Multiple workarounds exist (macOS toolchain refresh, Windows CLI downgrade, avoid spaces in user path). No single root cause accepted across platforms.
  • A final question asks which Ruby version is in use, suggesting Ruby environment may be relevant. Discussion appears ongoing.
Summarized with AI on December 27. AI used: gpt-5.

so guys finally i got the solution the error coms from your username cous your username with space exampel C:\Users\hamdi ben bechir the solution is C:\Users\hamdibenbechir thank me later