Skip to content

Fix hardcoded macOS-specific Claude path#8

Open
jbn wants to merge 2 commits intojlowin:mainfrom
jbn:main
Open

Fix hardcoded macOS-specific Claude path#8
jbn wants to merge 2 commits intojlowin:mainfrom
jbn:main

Conversation

@jbn
Copy link
Copy Markdown

@jbn jbn commented Jul 10, 2025

The claude-wt CLI was failing with an "unknown option '--add-dir'" error on Linux systems. The root cause was that the fallback path for the Claude executable was hardcoded to a macOS-specific path (/Users/jlowin/.claude/local/claude).

When shutil.which("claude") couldn't find the executable (because it's an alias, not in PATH), the code would fall back to this macOS /User/* path (which doesn't exist on Linux systems) for jlowin (who is one of a kind). This caused the subprocess to fail when trying to execute a non-existent file.

Fixed by replacing the hardcoded path with a dynamic path using Path.home() to construct the user-agnostic path
~/.claude/local/claude. This ensures the CLI works correctly across different operating systems and users (expect windows, probably, which I did not test and I'm not even sure is supported by claude).

jbn and others added 2 commits July 10, 2025 11:08
The `claude-wt` CLI was failing with an "unknown option '--add-dir'"
error on Linux systems. The root cause was that the fallback path for
the Claude executable was hardcoded to a macOS-specific path
(`/Users/jlowin/.claude/local/claude`).

When `shutil.which("claude")` couldn't find the executable (because it's
an alias, not in PATH), the code would fall back to this macOS path,
which doesn't exist on Linux systems. This caused the subprocess to fail
when trying to execute a non-existent file.

Fixed by replacing the hardcoded path with a dynamic path using
`Path.home()` to construct the user-agnostic path
`~/.claude/local/claude`. This ensures the CLI works correctly across
different operating systems and users.
Handle both branch name formats from `git worktree list --porcelain`:
- Older format: "branch claude-wt-foo"
- Newer format: "branch refs/heads/claude-wt-foo"

This ensures all claude-wt worktrees are properly detected regardless
of the git version being used.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant