Repository navigation
Claude code not found #76
Description
Activity
Hi @Dragna,
I've been working on a similar issue for Windows (#78) and developed patches for
claude_binary.rsthat improve path detection.The main problem is that Claudia only searches in predefined paths. In my fix, I've patched
claude_binary.rsto add additional search paths and improved the detection mechanism.While my solution is Windows-focused, the approach of adding custom paths to
find_standard_installations()could work for your mise installation path too.For your specific path
~/.local/share/mise/installs/node/24.0.1/bin/claude, you could add it to the paths_to_check vector in the patchesCheck out the patches here:
https://gist.github.com/Kirchlive/184cdd96a56bfd7a6c67997836495f3cHope it helps! 🙂
HI @Kirchlive , thank you for your feedback and explanations, I'll look into this 🙏
Hello, I'm encountering this same issue, but with the
asdfversion manager. Mywhich claudepoints to~/.asdf/shims/claude, and the application fails with/Users/puya/.asdf/shims/claude: line 3: exec: asdf: not found.After extensive debugging, we've pinpointed the root cause:
Like many GUI applications on macOS, the Tauri app runs with a minimal
PATHenvironment variable that does not include paths from the user's shell configuration (.zshrc,.bash_profile, etc.). We confirmed by logging the environment that thePATHavailable to the child process is only/usr/bin:/bin:/usr/sbin:/sbin.This minimal
PATHcreates two critical failures:- Shim Execution Fails: The
asdfshim script cannot find the mainasdfexecutable, henceexec: asdf: not found. - Direct Execution Fails: Even if we bypass the shim and execute the real script at
~/.asdf/installs/nodejs/lts/bin/claude, that script (which starts with#!/usr/bin/env node) fails withenv: node: No such file or directorybecause thenodeexecutable isn't in the minimalPATHeither.
We attempted several workarounds, including creating symlinks in
/usr/local/binand modifying the Rust code to prepend paths, but these were unsuccessful because of the restrictive environment.Proposed Solution:
The most robust solution would be for Claudia to handle version managers explicitly in its binary discovery logic. When discovering the
claudebinary, the application should:- Detect Shims: Check if a discovered path is a version manager shim (e.g., contains
/.asdf/shims/or/.mise/shims/). - Resolve to Real Binary: If it's a shim, resolve it to the actual executable path (e.g.,
~/.asdf/installs/nodejs/VERSION/bin/claude). This could be done by parsing the relevant.tool-versionsfile. - Execute with Correct Environment: When executing the real binary, prepend its containing directory (e.g.,
~/.asdf/installs/nodejs/VERSION/bin) to the command'sPATH. This ensures the script can find the correctnodeversion it was installed with.
This approach would make the application much more resilient for users who rely on modern version managers like
asdformise. Thank you for your work on this great tool!Reacted by Gilad Peleg- Shim Execution Fails: The
Hi everyone, just wanted to share a detailed workaround that finally solved this issue for me on macOS with
asdf. It's a bit involved, but it's been working reliably. Hope this helps anyone else with a similar setup!The root cause is that the sandboxed Tauri application does not inherit the
PATHfrom your shell, so it cannot find theasdfexecutable required to run theclaudeshim.This solution creates a simple wrapper script that sets up the environment correctly and then tells the Claudia application to use that script instead of trying to find
claudeitself.The Solution: Step-by-Step
1. Create a Wrapper Script:
Create a new file named
run-claude.shin the root directory of the Claudia project with the following content. This script correctly finds the realclaudeexecutable and runs it with the right environment.#!/bin/sh # # Claudia Wrapper Script for ASDF - v3 (Direct Execution) # # This script bypasses the asdf shim system entirely and executes the real # claude binary directly, with the correct node version in its PATH. set -e # --- Environment Setup --- USER_HOME=$(eval echo ~$(whoami)) ASDF_DIR="$USER_HOME/.asdf" # --- Find the real claude executable --- # 1. Read the nodejs version from .tool-versions NODE_VERSION=$(grep "nodejs" "$USER_HOME/.tool-versions" | awk '{print $2}') # 2. Construct the path to the real node and claude executables NODE_BIN_DIR="$ASDF_DIR/installs/nodejs/$NODE_VERSION/bin" CLAUDE_EXEC="$NODE_BIN_DIR/claude" # 3. Construct the minimal, correct PATH # The only thing that matters is that the correct 'node' is found first. export PATH="$NODE_BIN_DIR:/usr/bin:/bin" # --- Execution --- # Execute the real claude binary directly. exec "$CLAUDE_EXEC" "$@"
2. Make the Script Executable:
In your terminal, run the following command from the project's root directory:
chmod +x run-claude.sh3. Create a Local
binDirectory and Link the Script:This creates a stable location for the application to find our wrapper.
# Create the directory mkdir -p ~/claudia-bin # Get the full path to your project directory PROJECT_DIR=$(pwd) # Create the symlink ln -sf "$PROJECT_DIR/run-claude.sh" ~/claudia-bin/claude
4. Modify the Claudia Source Code:
This is the final step. We need to tell the application to look for our script. Open the following file in the Claudia project:
src-tauri/src/claude_binary.rs.Replace the entire contents of that file with the simplified code below. This new code removes all the complex discovery logic and tells the app to look in one, and only one, place:
~/claudia-bin/claude.use anyhow::Result; use log::{debug, error, info}; use serde::{Deserialize, Serialize}; use std::path::PathBuf; use std::process::Command; /// Represents a Claude installation with metadata #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ClaudeInstallation { pub path: String, pub version: Option<String>, pub source: String, } /// Main function to find the Claude binary. /// This is now simplified to only find our robust wrapper script. pub fn find_claude_binary(_app_handle: &tauri::AppHandle) -> Result<String, String> { info!("Searching for claude binary via the claudia-bin wrapper method..."); if let Ok(home) = std::env::var("HOME") { let wrapper_path = PathBuf::from(&home).join("claudia-bin").join("claude"); let path_str = wrapper_path.to_string_lossy().to_string(); if wrapper_path.exists() && wrapper_path.is_file() { info!("Found claude wrapper at: {}", path_str); return Ok(path_str); } else { let error_msg = format!( "FATAL: The claude wrapper was not found at the expected path: {}. Please re-run the setup steps.", path_str ); error!("{}", error_msg); return Err(error_msg); } } else { let error_msg = "Could not determine home directory.".to_string(); error!("{}", error_msg); Err(error_msg) } } /// This function is kept for compatibility but now only finds the wrapper. pub fn discover_claude_installations() -> Vec<ClaudeInstallation> { let mut installations = Vec::new(); if let Ok(home) = std::env::var("HOME") { let wrapper_path = PathBuf::from(&home).join("claudia-bin").join("claude"); if wrapper_path.exists() && wrapper_path.is_file() { installations.push(ClaudeInstallation { path: wrapper_path.to_string_lossy().to_string(), version: Some("wrapper".to_string()), source: "Wrapper Script".to_string(), }); } } installations } /// Helper function to create a Command. /// The complex environment setup is now handled entirely by the wrapper script. pub fn create_command_with_env(program: &str) -> Command { let mut cmd = Command::new(program); if let Ok(cwd) = std::env::current_dir() { cmd.current_dir(&cwd); // Use a borrow here debug!("Set working directory for command to project root: {:?}", cwd); } cmd }
5. Build and Run:
Finally, rebuild and run the application.
bun run tauri devThis approach should now work reliably for anyone using
asdfon macOS.I'm having the same issue with
asdfis there any solution without modifying source?Same. An out-of-the-box solution from claudia's team would be awesome ;).
I think they have implemented a fix for this. Mine works on the latest versions of Claudia
It's not resolved for me, just tried latest version
I faced same problem with latest version.
I installedclaudecommand usingmise.This comment solution solved the problem.
If I run with from terminal with /Applications/opcode.app/Contents/MacOS/opcode

I get an error
Claude code not foundevent though Claude code is installed.in my case Claude is installed here :
~/.local/share/mise/installs/node/24.0.1/bin/claudeis there a way to let claudia know about this path from my side ?
Thank you in advance for your help 🙂