0

I have installed the Rust programming language (Debian). Now i can compile and run programs from terminal (with the cargo build and cargo run commands), but not from inside emacs. The cargo compiler stays on my system in /home/me/.cargo/bin/cargo and emacs is not looking there to find the interpreter. I get this error /bin/bash: cargo: command not found by running M-x &, cargo build. So how can i tell emacs the address of cargo binary, or is it better to send the binary to the address emacs looks in?

  • 1
    I think you forgot to add export PATH="$HOME/.cargo/bin:$PATH" to your bashrc ? You should also try cargo.el. – bertfred Aug 7 '17 at 11:36
  • export PATH="$HOME/.cargo/bin:$PATH" is already in bashrc. I have installed the cargo.el package, same error. Emacs can't find the cargo binary. – amirt Aug 7 '17 at 12:47
0

I set up the exec-path variable so that emacs finds the cargo binary at ~/.cargo/bin:

(setenv "PATH" (concat (getenv "PATH") ":" (expand-file-name "~/.cargo/bin")))
(setq exec-path (append exec-path (list (expand-file-name "~/.cargo/bin"))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.