bashemacsaquamacstramp

Tramp using ssh does not source .bash_profile / .profile


I'm using Aquamacs (graphical emacs for OSX using emacs 24 and tramp version 2.2.3) to edit some files on a remote server. Tramp is set up to use ssh and works fine in terms of editing files.

It fails when it comes to compiling because the compiler is not in the path. It seems like tramp does not source any of the profile files like .profile or .bash_profile. /bin/sh is a link to /bin/bash so bash should be the shell used by tramp. A shell started within emacs on the remote server won't source anything, too. A ssh connection from a regular terminal emulator (tried Terminal and X11 on OS X) works as expected (everything sourced correctly).

Any ideas?


Solution

  • /bin/sh is a link to /bin/bash so bash should be the shell used by tramp.

    Its not the same. When invoked as "sh", it will behave like sh and not bash, hence the bash specific rc/profile files (e.g. ~/.bash_profile, ~/.bashrc) won't be sourced. However ~/.profile will be read. Your problem might be you are using bash syntax to setup stuff in your ~/.profile.

    This will not work:

    export PATH=/some/path:$PATH
    

    But this will:

    PATH=/some/path:$PATH
    export PATH