running command on remote machine with tramp?
Asked Answered
J

1

6

I opened a file on the remote machine, and typed C-u M-! and then typed tree command. It showed in the buffer:

/bin/sh: tree: command not found

The tree command is installed into /home/RNAer/bin, and I verified it can run successfully when login with bash terminal.

Then I added the path in the .emacs like the following and restart emacs,

(add-to-list 'tramp-remote-path "/home/RNAer/bin")

but it still has the same error of command not found. what's the problem?

Jodyjoe answered 19/2, 2013 at 7:16 Comment(3)
Where did you add /home/RNAer/bin to $PATH on the remote machine? In other words, is this directory also added to $PATH in non-interactive shell sessions?Shane
It is added to ~/.bashrc (which is sourced by ~/.bash_profile), in the interactive shell. But I tested it - even if I add to the $PATH in non-interactive shell session, it still failed.Jodyjoe
Did you remove your persistency file? (By default the persistency file is ~/.emacs.d/tramp)Faller
L
0

I had the same problem, I solved by adding the following lines to .emacs

(require 'tramp) 
(add-to-list 'tramp-remote-path "/home/RNAer/bin")

Note that without first line the second line throws error. You could double check your tramp-remote-path by

(message (format "%s" tramp-remote-path))

to see if your path is set correctly.

Lollar answered 5/9, 2017 at 18:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.