Search code examples
ruby-on-railsvagrantguard

Getting guard to work with VM, Vagrant


I saw some of the other answers about this but I need more of a step by step guide.

My host machine is windows 8 and Im running ubuntu/trusty64 server box on vagrant.

The only setting I have on vagrant file is config.vm.network "forwarded_port", guest: 3000, host: 3000

I open a terminal on my host machine and cd to the shared folder on my host machine then type listen -f "10.0.0.2:4000" and its asking my to install celluloid-io. Do I just type gem install celluloid-io? I've tried this and then it seems to run but says something about a wdm adapter since I'm on windows. Is there a way around this?

On guest machine I type guard -o "10.0.0.2:4000" and it asks for celluloid. I type gem install celluloid-io and then it keeps asking for celluloid.

Should I just forget all this and use polling? Seems easier but not ideal. How can I get this to work. I feel like I'm very wrong here.


Solution

  • I had similar issues. My solution was to change the way Vagrant does the folder sync to "rsync" as described here.

    My host is MacOS, so rsync is built in. But for windows, you could use cygwin to install rsync.

    Once you've set up folder syncing this way, you can just use Guard as-is, without having to install the listen gem or try to use TCP port forwarding to pass filesystem events from your host to vagrant.