With recent versions of Emacs, tramp routinely hangs at the time of making the connection.

The *Messages* buffer gives no information.

Is there a way to get more information as to what's happening?

I have seen this hanging behavior in two forms.

On sudo-based connections, tramp hangs right after I enter the password for sudo, and hit return.

On ssh-based connections, tramp will hang right after the appearance of the message

Waiting from prompts from remote shell... 

In either case, it would be helpful to know what tramp is doing all this time.

2 Answers 2


Read the Tramp manual about traces (info "(tramp) Traces and Profiles")

In short, set tramp-verbose to 6, rerun your test, and check the Tramp debug buffer. In some rare cases it might be necessary to use a higher verbosity, up to 10.

If you have problems understanding the traces, contact the Tramp team by writing a bug report to <[email protected]>.


I had it hang because it couldn't detect the shell prompt, I added this to my .zshenv file..

# Fix for TRAMP
[ $TERM = "dumb" ] && unsetopt zle && PS1='$ '

Alternatively you can change what is considered a shell prompt by emacs..

; The default does not like the ~ before > so do a kludge
(setq shell-prompt-pattern '"^[^#$%>\n]*~?[#$%>] *")

(Mine is "[hostname] ~> ")

  • 2
    That fixed mine too. The default zsh shell prompt seems to break Tramp.
    – MikeHoss
    Commented May 9, 2019 at 19:26
  • Thanks, I did not realize this is how TRAMP works. So it stands to reason that some of these fancy Z shell prompts github.com/ohmyzsh/ohmyzsh/wiki/Themes#themes will also be incompatible with TRAMP, by default? Commented Jun 11, 2022 at 20:16
  • 2
    Yes, but if you modify the .zshenv as I did then the fancy prompt will be disabled for TRAMP (because the TERM type will be 'dumb' rather than, say, xterm)
    – Darius
    Commented Jun 12, 2022 at 23:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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