Capistrano can't find svn

I’m trying to get capistrano to deploy to an osx machine - rake
remote:cold_deploy but it fails on the svn co line with

“bash: line 2: svn: command not found”

I’ve set the proper path to svn (/usr/local/bin) in both .bash_profile
and .bash_login but capistrano seems to be ignoring these.

How does capistrano know where to look for svn?

Thanks

Oops! Didn’t notice:

set :svn, “/path/to/svn” # defaults to searching the PATH

in deploy.rb. Still it doesn’t seem to search the PATH.

Hammed,

You need to set the :svn variable. The PATH it searches is the path
that is baked into sshd, which is usually only /bin and /usr/bin.

  • Jamis

Jamis B. wrote:

You need to set the :svn variable. The PATH it searches is the path
that is baked into sshd, which is usually only /bin and /usr/bin.

You can generally modify the search path for remote ssh commands by
creating a .bashrc file in your home directory. For example, mine says:

export PATH=$HOME/local/bin:$PATH

on a machine where I have my own copies of a lot of binaries.

–Al Evans

Hi Al,

You can generally modify the search path for remote ssh commands by
creating a .bashrc file in your home directory. For example, mine says:

export PATH=$HOME/local/bin:$PATH

Are you sure about this? I tried it and it didn’t work. I have

export PATH=/usr/local/bin:$PATH

in my .bashrc which is in the home directory and is executable.

Hammed M. wrote:

You can generally modify the search path for remote ssh commands by
creating a .bashrc file in your home directory. For example, mine says:

export PATH=$HOME/local/bin:$PATH

Are you sure about this? I tried it and it didn’t work. I have

export PATH=/usr/local/bin:$PATH

in my .bashrc which is in the home directory and is executable.

Works for me as well. Your .bashrc (on the remote host, right?) doesn’t
need to be executable. You also have to have .bashrc as your login
shell. If your login shell is tcsh you need a .cshrc file.

Ray

Ray,

The .bashrc file is on the remote server which is OSX.

According to http://www.osxfaq.com/tips/unix-tricks/week105/monday.ws
, non-login shells don’t run any scripts on startup:

Non-interactive shells. When you run a shell script, a new shell is
launched to execute the script. The new shell is a non-interactive
(non-login) shell. It does not source any scripts on startup.

Note, however, that Capistrano does not use a login shell, thus
the .bashrc is not executed when Capistrano sessions are created.

There are supposedly ways to work around this–for instance, if your
sshd is configured to support it, you can have ~/.ssh/environment
contain the variables you want set by all new sessions (login shell
or not). However, this appears to be disabled by default for most
installations.

  • Jamis

Hammed M. wrote:

The .bashrc file is on the remote server which is OSX.

According to http://www.osxfaq.com/tips/unix-tricks/week105/monday.ws
, non-login shells don’t run any scripts on startup:

Non-interactive shells. When you run a shell script, a new shell is
launched to execute the script. The new shell is a non-interactive
(non-login) shell. It does not source any scripts on startup.

The ssh session is a login shell. A Non-interactive shell is when you
execute a shell script. The ssh session logins you in.

I added this line to my .bashrc on my OS X server,

echo “Hi there”

Then I sshed to that machine from another server

stork$ ssh ray@auk date
Hi there
Wed May 17 22:46:55 PDT 2006
stork$

You can see that the contents of the .bashrc appear.

Your problem may be the presence of a .bash_profile

When bash is invoked as an interactive login shell, or as a non-inter-
active shell with the --login option, it first reads and executes com-
mands from the file /etc/profile, if that file exists. After reading
that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
in that order, and reads and executes commands from the first one that
exists and is readable. The --noprofile option may be used when the
shell is started to inhibit this behavior.

Ray