Skip to content

Commit f4bd621

Browse files
julienldclaude
andcommitted
fix(macos): use full path to uvx in Claude Desktop config
Claude Desktop doesn't inherit the user's shell PATH, so it can't find uvx when installed to ~/.local/bin. The installer now detects the full path to uvx and writes it to the config. Users who already installed can re-run the installer to fix their config - the script will update the existing Home Assistant MCP entry. Fixes: "Failed to spawn process: No such file or directory" error 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8a09fe5 commit f4bd621

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

scripts/install-macos.sh

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ else
4141
exit 1
4242
fi
4343
fi
44+
45+
# Get full path to uvx (Claude Desktop doesn't inherit shell PATH)
46+
UVX_PATH=""
47+
if command -v uvx > /dev/null 2>&1; then
48+
UVX_PATH=$(command -v uvx)
49+
elif [ -x "$HOME/.local/bin/uvx" ]; then
50+
UVX_PATH="$HOME/.local/bin/uvx"
51+
elif [ -x "/usr/local/bin/uvx" ]; then
52+
UVX_PATH="/usr/local/bin/uvx"
53+
elif [ -x "/opt/homebrew/bin/uvx" ]; then
54+
UVX_PATH="/opt/homebrew/bin/uvx"
55+
else
56+
printf "${RED} Could not find uvx. Please check your installation.${NC}\n"
57+
exit 1
58+
fi
59+
printf " Using uvx at: ${BLUE}%s${NC}\n" "$UVX_PATH"
4460
printf "\n"
4561

4662
# Step 2: Configure Claude Desktop
@@ -54,9 +70,9 @@ fi
5470
# Create config directory if needed
5571
mkdir -p "$CONFIG_DIR"
5672

57-
# The MCP server config to add
73+
# The MCP server config to add (using full path for Claude Desktop compatibility)
5874
HA_MCP_CONFIG='{
59-
"command": "uvx",
75+
"command": "'"$UVX_PATH"'",
6076
"args": ["ha-mcp@latest"],
6177
"env": {
6278
"HOMEASSISTANT_URL": "'"$DEMO_URL"'",
@@ -86,6 +102,7 @@ import sys
86102
config_file = "$CONFIG_FILE"
87103
demo_url = "$DEMO_URL"
88104
demo_token = "$DEMO_TOKEN"
105+
uvx_path = "$UVX_PATH"
89106
90107
try:
91108
with open(config_file, 'r') as f:
@@ -101,9 +118,9 @@ except (json.JSONDecodeError, FileNotFoundError):
101118
if 'mcpServers' not in config:
102119
config['mcpServers'] = {}
103120
104-
# Add/update Home Assistant config
121+
# Add/update Home Assistant config (using full path for Claude Desktop compatibility)
105122
config['mcpServers']['Home Assistant'] = {
106-
"command": "uvx",
123+
"command": uvx_path,
107124
"args": ["ha-mcp@latest"],
108125
"env": {
109126
"HOMEASSISTANT_URL": demo_url,
@@ -117,12 +134,12 @@ with open(config_file, 'w') as f:
117134
print(" Configuration updated successfully")
118135
EOF
119136
else
120-
# Create new config file
137+
# Create new config file (using full path for Claude Desktop compatibility)
121138
cat > "$CONFIG_FILE" << EOF
122139
{
123140
"mcpServers": {
124141
"Home Assistant": {
125-
"command": "uvx",
142+
"command": "$UVX_PATH",
126143
"args": ["ha-mcp@latest"],
127144
"env": {
128145
"HOMEASSISTANT_URL": "$DEMO_URL",
@@ -140,7 +157,7 @@ printf "\n"
140157
# Step 3: Pre-download dependencies
141158
printf "${YELLOW}Step 3: Pre-downloading ha-mcp...${NC}\n"
142159
printf " This speeds up Claude Desktop startup...\n"
143-
uvx ha-mcp@latest --help > /dev/null 2>&1 || true
160+
"$UVX_PATH" ha-mcp@latest --help > /dev/null 2>&1 || true
144161
printf "${GREEN} Dependencies cached${NC}\n"
145162
printf "\n"
146163

0 commit comments

Comments
 (0)