# Capistrano to deploy to Mac OS X?

**URL:** <https://www.ruby-forum.com/t/capistrano-to-deploy-to-mac-os-x/60709>\
**Category:** Rails\
**Created:** [May 16, 2006, 10:23pm UTC](https://www.ruby-forum.com/t/capistrano-to-deploy-to-mac-os-x/60709 "2006-05-16T22:23:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josh\_on\_Rails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@Josh\_on\_Rails](https://www.ruby-forum.com/u/Josh_on_Rails)\
**Post date:** [May 16, 2006, 10:23pm UTC](https://www.ruby-forum.com/t/capistrano-to-deploy-to-mac-os-x/60709/1 "2006-05-16T22:23:28Z")

</div>

We’re moving some “internal use” apps to a spare internal machine -  
instead  
of a public, shared host. I’m not sure if it’s relevant, but the new  
machine  
is running OS 10.3.

I’m having a strange problem using Capistrano. It happens on both our  
development machines, and only when deploying to this server.

I run ‘cap deploy’ and get:

in `process!': command "if [[! -d /Users/www/myappnamehere/releases/20060516200956]]; then svn co --username josh -q -r741 http://mysvn/myappnamehere/trunk/Users/www/myappnamehere/releases/20060516200956 && (test -e /Users/www/myappnamehere/revisions.log || touch /Users/www/myappnamehere/revisions.log && chmod 666 /Users/www/myappnamehere/revisions.log) && echo`date +"%Y-%m-%d  
%H:%M:%S"` $USER 741 20060516200956 \>\>  
/Users/www/myappnamehere/revisions.log;  
fi" failed

If I paste this command into terminal on the new server, I get:

date: illegal format

Eye-balling it, it looks like this might be backslashes on the ""s, so I  
strip those, and try again… and it works. So, I can manually check-out  
my  
project, using the same commands as Capistrano would use, but I can’t  
use  
Capistrano.

I suppose it shows how dependent on Capistrano I’ve become, that this  
annoys  
me so.

I’ve been staring at this all day, so I’m probably going cross-eyed, but  
I  
can’t see what would be causing this to happen?

---

<div class="post-metadata">

**Author:** ![Josh\_on\_Rails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@Josh\_on\_Rails](https://www.ruby-forum.com/u/Josh_on_Rails)\
**Post date:** [May 17, 2006, 2:40am UTC](https://www.ruby-forum.com/t/capistrano-to-deploy-to-mac-os-x/60709/2 "2006-05-17T02:40:43Z")

</div>

Looks like Mac OS X’s date command isn’t compatible with that syntax:

> ~: date +"%Y-%m-%d %H:%M:%S"  
> date: illegal time format  
> usage: date [-nu] [-r seconds] [+format]  
> date [[[[[cc]yy]mm]dd]hh]mm[.ss]

I’d grab the gnu source, build and install it into /usr/local/bin,  
and make sure your deployment user environment had /usr/local/bin  
first in PATH.

–  
– Tom M.

---

<div class="post-metadata">

**Author:** ![Josh\_on\_Rails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@Josh\_on\_Rails](https://www.ruby-forum.com/u/Josh_on_Rails)\
**Post date:** [May 17, 2006, 3:40pm UTC](https://www.ruby-forum.com/t/capistrano-to-deploy-to-mac-os-x/60709/3 "2006-05-17T15:40:27Z")

</div>

Wow… Okay, easier said than done, but I’ll keep digging…

Are the slash-quotes part of the command, or are they being escaped in  
the  
error output? Because when I take the slashes out, it works. Which makes  
me  
suspicious, is all I’m saying.

Is anybody else using Cap to deploy to OS X having this problem?

---

<div class="post-metadata">

**Author:** ![Josh\_on\_Rails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@Josh\_on\_Rails](https://www.ruby-forum.com/u/Josh_on_Rails)\
**Post date:** [May 17, 2006, 4:44pm UTC](https://www.ruby-forum.com/t/capistrano-to-deploy-to-mac-os-x/60709/4 "2006-05-17T16:44:24Z")

</div>

So, continuing with this…

The command in question comes from:  
/usr/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0  
/lib/capistrano/scm/base.rb

def logging\_commands(directory = nil)  
log = “#{configuration.deploy\_to}/revisions.log”

"(test -e #{log} || touch #{log} && chmod 666 #{log}) && " +  
“echo `date +\"%Y-%m-%d %H:%M:%S\"` $USER #{configuration.revision}  
#{directory} \>\> #{log};”  
end

So, stuck on this idea that the " are the problem, I took them out:

def logging\_commands(directory = nil)  
log = “#{configuration.deploy\_to}/revisions.log”

“(test -e #{log} || touch #{log} && chmod 666 #{log}) && " +  
'echo `date +"%Y-%m-%d %H:%M:%S"`’ + " $USER #{configuration.revision}  
#{directory} \>\> #{log};”  
end

Yet, when I run “cap deploy” in Terminal, I get:

in `process!': command "if [[! -d /Users/www/myappnamehere/releases/20060517142841]]; then\\\n svn co --username josh -q -r741 http://mysvnserver/myappnamehere/Users/www/myappnamehere/releases/20060517142841 &&\\\n (test -e /Users/www/myappnamehere/revisions.log || touch /Users/www/myappnamehere/revisions.log && chmod 666 /Users/www/myappnamehere/revisions.log) && echo`date +"%Y-%m-%d  
%H:%M:%S"` $USER 741 20060517142841 \>\>  
/Users/www/myappnamehere/revisions.log;\\n fi" failed on  
myserver (RuntimeError)

That is, the " are back! So, the logging\_commands seem to get escaped  
somewhere - it’s not clear to me whether they get escaped in the error  
logger, or in the command processor…

Oh: And I can run  
echo `date +"%Y-%m-%d %H:%M:%S"` test1 test2 test3 \>\> test.log;

on the server without problems.

What am I missing?

---

<div class="post-metadata">

**Author:** ![Josh\_on\_Rails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@Josh\_on\_Rails](https://www.ruby-forum.com/u/Josh_on_Rails)\
**Post date:** [May 17, 2006, 6:50pm UTC](https://www.ruby-forum.com/t/capistrano-to-deploy-to-mac-os-x/60709/5 "2006-05-17T18:50:18Z")

</div>

> “(test -e #{log} || touch #{log} && chmod 666 #{log}) && " +  
> 'echo `date +"%Y-%m-%d %H:%M:%S"`’ + " $USER #{configuration.revision}  
> #{directory} \>\> #{log};”  
> end

What happens if you remove the slashes the alternate way? i.e.:

"echo `date +'%Y-%m-%d %H:%M:%S'`"

-r
