Files
claude-mem/docs/reports/2026-01-04--issue-527-uv-homebrew-analysis.md
T
Alex Newman 316d9cf96b fix: Address GitHub issues #511, #517, #527, #531 (#542)
* feat(docs): Add analysis reports for issues #514, #517, #520, #527, and #532

- Issue #514: Documented analysis of orphaned observer session files, including root cause, evidence, and recommended fixes.
- Issue #517: Analyzed PowerShell escaping issues in cleanupOrphanedProcesses() on Windows, with recommended fixes using WMIC.
- Issue #520: Confirmed resolution of stuck messages issue through architectural changes to a claim-and-delete pattern.
- Issue #527: Identified detection failure of uv on Apple Silicon Macs with Homebrew installation, proposed path updates for detection.
- Issue #532: Analyzed memory leak issues in SessionManager, detailing session cleanup and conversationHistory growth concerns, with recommended fixes.

* fix: address GitHub issues #511, #517, #527, #531

- #511: Add gemini-3-flash model to GeminiAgent (type, RPM limits, validation)
- #517: Replace PowerShell with WMIC for Windows process management (fixes Git Bash/WSL)
- #527: Add Apple Silicon Homebrew paths for bun and uv detection
- #531: Remove duplicate type definitions from export-memories.ts using bridge file

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(docs): Add detailed reports for issues #511 and #531 addressing model validation and type duplication

* test: add regression tests for PR #542 fixes

Adds comprehensive regression tests for all 4 issues addressed in PR #542:

- #511: Add gemini-3-flash model tests to verify model acceptance and rate limiting
- #517: Add WMIC parsing tests for Windows process enumeration (23 tests)
- #527: Add Apple Silicon Homebrew path tests for bun/uv detection (18 tests)
- #531: Add export types tests to validate type interfaces (12 tests)

Total: 53 new tests, all passing. Addresses PR review feedback requesting test coverage.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 02:21:02 -05:00

113 lines
3.7 KiB
Markdown

# Issue #527: uv Detection Fails on Apple Silicon Macs with Homebrew Installation
**Date**: 2026-01-04
**Issue**: GitHub Issue #527
**Status**: Confirmed - Fix Required
## Summary
The `isUvInstalled()` function fails to detect uv when installed via Homebrew on Apple Silicon Macs because it does not check the `/opt/homebrew/bin/uv` path.
## Analysis
### Files Affected
Two copies of `smart-install.js` exist in the codebase:
1. **Source file**: `/Users/alexnewman/Scripts/claude-mem/scripts/smart-install.js`
2. **Built/deployed file**: `/Users/alexnewman/Scripts/claude-mem/plugin/scripts/smart-install.js`
### Current uv Path Detection
**Source file (`scripts/smart-install.js`)** - Lines 22-24:
```javascript
const UV_COMMON_PATHS = IS_WINDOWS
? [join(homedir(), '.local', 'bin', 'uv.exe'), join(homedir(), '.cargo', 'bin', 'uv.exe')]
: [join(homedir(), '.local', 'bin', 'uv'), join(homedir(), '.cargo', 'bin', 'uv'), '/usr/local/bin/uv'];
```
**Plugin file (`plugin/scripts/smart-install.js`)** - Lines 103-105:
```javascript
const uvPaths = IS_WINDOWS
? [join(homedir(), '.local', 'bin', 'uv.exe'), join(homedir(), '.cargo', 'bin', 'uv.exe')]
: [join(homedir(), '.local', 'bin', 'uv'), join(homedir(), '.cargo', 'bin', 'uv'), '/usr/local/bin/uv'];
```
### Paths Currently Checked (Unix/macOS)
| Path | Installer | Architecture |
|------|-----------|--------------|
| `~/.local/bin/uv` | Official installer | Any |
| `~/.cargo/bin/uv` | Cargo/Rust install | Any |
| `/usr/local/bin/uv` | Homebrew (Intel) | x86_64 |
### Missing Path
| Path | Installer | Architecture |
|------|-----------|--------------|
| `/opt/homebrew/bin/uv` | Homebrew (Apple Silicon) | arm64 |
## Root Cause
Homebrew installs to different prefixes depending on architecture:
- **Intel Macs (x86_64)**: `/usr/local/bin/`
- **Apple Silicon Macs (arm64)**: `/opt/homebrew/bin/`
The current implementation only includes the Intel Homebrew path, causing detection to fail on Apple Silicon when:
1. uv is installed via `brew install uv`
2. The user's shell PATH is not available during script execution (common in non-interactive contexts)
## Impact
Users on Apple Silicon Macs who installed uv via Homebrew will:
1. See "uv not found" errors
2. Have uv unnecessarily reinstalled via the official installer
3. End up with duplicate installations
## Recommended Fix
Add `/opt/homebrew/bin/uv` to the Unix paths array.
### Source file (`scripts/smart-install.js`) - Line 24
**Before:**
```javascript
: [join(homedir(), '.local', 'bin', 'uv'), join(homedir(), '.cargo', 'bin', 'uv'), '/usr/local/bin/uv'];
```
**After:**
```javascript
: [join(homedir(), '.local', 'bin', 'uv'), join(homedir(), '.cargo', 'bin', 'uv'), '/usr/local/bin/uv', '/opt/homebrew/bin/uv'];
```
### Plugin file (`plugin/scripts/smart-install.js`) - Lines 103-105 and 222-224
The same fix should be applied in both locations where `uvPaths` is defined:
- Line 105 in `isUvInstalled()`
- Line 224 in `installUv()`
### Note: Bun Has the Same Issue
The Bun detection has the same gap:
**Current (`scripts/smart-install.js` line 20):**
```javascript
: [join(homedir(), '.bun', 'bin', 'bun'), '/usr/local/bin/bun'];
```
**Should also add:**
```javascript
: [join(homedir(), '.bun', 'bin', 'bun'), '/usr/local/bin/bun', '/opt/homebrew/bin/bun'];
```
## Verification
After the fix, verify by:
1. Installing uv via Homebrew on an Apple Silicon Mac
2. Running the smart-install script
3. Confirming uv is detected without attempting reinstallation
## Conclusion
**Fix is required.** The `/opt/homebrew/bin/uv` path is missing from both files. This is a simple one-line addition to the path arrays. The same fix should also be applied to Bun detection paths for consistency.