# Capistrano can't find svn

**URL:** <https://www.ruby-forum.com/t/capistrano-cant-find-svn/60725>\
**Category:** Rails\
**Created:** [May 17, 2006, 12:53am UTC](https://www.ruby-forum.com/t/capistrano-cant-find-svn/60725 "2006-05-17T00:53:31Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hammed\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/7feea3/32.png) [@Hammed\_M](https://www.ruby-forum.com/u/Hammed_M)\
**Post date:** [May 17, 2006, 12:53am UTC](https://www.ruby-forum.com/t/capistrano-cant-find-svn/60725/1 "2006-05-17T00:53:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Hammed\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/7feea3/32.png) [@Hammed\_M](https://www.ruby-forum.com/u/Hammed_M)\
**Post date:** [May 17, 2006, 1:08am UTC](https://www.ruby-forum.com/t/capistrano-cant-find-svn/60725/2 "2006-05-17T01:08:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Hammed\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/7feea3/32.png) [@Hammed\_M](https://www.ruby-forum.com/u/Hammed_M)\
**Post date:** [May 17, 2006, 9:53pm UTC](https://www.ruby-forum.com/t/capistrano-cant-find-svn/60725/3 "2006-05-17T21:53:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Hammed\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/7feea3/32.png) [@Hammed\_M](https://www.ruby-forum.com/u/Hammed_M)\
**Post date:** [May 17, 2006, 11:05pm UTC](https://www.ruby-forum.com/t/capistrano-cant-find-svn/60725/4 "2006-05-17T23:05:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Hammed\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/7feea3/32.png) [@Hammed\_M](https://www.ruby-forum.com/u/Hammed_M)\
**Post date:** [May 18, 2006, 4:55am UTC](https://www.ruby-forum.com/t/capistrano-cant-find-svn/60725/5 "2006-05-18T04:55:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Hammed\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/7feea3/32.png) [@Hammed\_M](https://www.ruby-forum.com/u/Hammed_M)\
**Post date:** [May 18, 2006, 6:42am UTC](https://www.ruby-forum.com/t/capistrano-cant-find-svn/60725/6 "2006-05-18T06:42:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Hammed\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/7feea3/32.png) [@Hammed\_M](https://www.ruby-forum.com/u/Hammed_M)\
**Post date:** [May 18, 2006, 7:31am UTC](https://www.ruby-forum.com/t/capistrano-cant-find-svn/60725/7 "2006-05-18T07:31:14Z")

</div>

Ray,

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

According to [http://www.osxfaq.com/tips/unix-tricks/week105/monday.ws](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.

---

<div class="post-metadata">

**Author:** ![Hammed\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/7feea3/32.png) [@Hammed\_M](https://www.ruby-forum.com/u/Hammed_M)\
**Post date:** [May 20, 2006, 8:58am UTC](https://www.ruby-forum.com/t/capistrano-cant-find-svn/60725/8 "2006-05-20T08:58:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Hammed\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/7feea3/32.png) [@Hammed\_M](https://www.ruby-forum.com/u/Hammed_M)\
**Post date:** [May 18, 2006, 7:58am UTC](https://www.ruby-forum.com/t/capistrano-cant-find-svn/60725/9 "2006-05-18T07:58:38Z")

</div>

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](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
