Unlike on UNIX based systems, installing and configuring RVM on a Windows machine properly in order to be able to use the new possibilities in Drupal's Omega 4 theme could become a difficult task. But running that process through the cygwin environment makes it possible.

Installing cygwin and required dependencies

Make sure you install the 32-bit version of cygwin, as otherwise you could get errors when trying to compile your ruby when installing it through rvm. So Install cygwin with following packages and their dependencies:

automake, bison, colorgcc, curl, gcc-g++, gcc-core, git, git-completion, git-gui, git-svn, gitk, libreadline7, libtool, libyaml-devel, libyaml0_2, make, mercurial, mingw64-i686-gcc-g++, nano, ncurses, openssh, openssl, openssl-devel, patch, readline, unzip, zlib, zlib-devel, sqlite3, mingw64-x86_64-gcc

Installing RVM

Open cygwin's command prompt and start the installation of RVM with the following command:

curl -L https://get.rvm.io | bash -s stable

This should download and install RVM in your in /home/user01/.rvm/ directory. So far so good. Just type

rvm -v

to ensure that RVM is installed. If you have installed ruby on your Windows machine previously - e.g. through something like Ruby Installer - I recommend to go ahead and uninstall it, as you will be managing your rubies through rvm from now on anyway.

Check that all cygwin requirements for RVM are installed:
Run
rvm requirements

If you need to install additional requirements and sends you an error listing the missing requirements then install those requirements using the cygwin setup.exe again, then run:

rvm requirements

and you should get the message:

Checking requirements for cygwin.
Requirements installation successful.

So now if you type

ruby -v

you should get something like "ruby not found", which we will change very soon.

Installing the ruby for your omega theme

Assuming, that you have a omega subtheme in your drupal installation, you can now navigate in the command line to the root of the subtheme. As soon as you are there RVM should recognize by the contents of the .ruby-version file that it needs to install a specific ruby version for that directory. In my case I get a message like

ruby-1.9.3-p448 is not installed.
To install do: 'rvm install ruby-1.9.3-p448'

So start the installation of the required version of ruby by entering

rvm install ruby-1.9.3-p448

Just press any key to continue if you're asked to install additional requirements. Then the installer should download, extract, configure, compile and install the version of ruby you specified.

Running bundler to install the necessary gems

If all went well you now have rvm and the version of ruby required by omega and you can run

bundle install

at that point, in order to install all gems for your omega theme. You will probably get an error of something like "... stack level too deep (SystemStackError)...". This is a cygwin/ruby issue and a good explanation and solution can be found here. So just run

peflags -X409600 `which ruby`

and now you can repeat

bundle install

This should download and install all gems, specified in the Gemfile file, create the Gemfile.lock just as usual.

Solve errors while running compass watch

At that point you can already run

compass watch

to have your sass files compile according to the settings in the config.rb file. The initial compilation will succeed, but you will probably get an error when you edit and the try to save a sass file of something like ("user01" is obviously my username at this cygwin installation. Yours may be different):

ArgumentError on line ["465"] of /home/user01/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/pathname.rb: different prefix: 
...
Run with --trace to see the full backtrace

This is a Windows-file system/compass issue and you can find good information of what is going on here.

The file you should edit in this case is the pathname.rb, which belongs to the fssm gem which was installed specifically for your theme by bundler earlier. It is residing in the /home/user01/.rvm/gems/ruby-1.9.3-p448@omega.new_omega/gems/fssm-0.2.10/lib/fssm directory.

Edit line 26 and append the following code to it

unless path[0, 1] == File::SEPARATOR

so that the full line 26 is reading

array[0] += File::SEPARATOR if path[0, 3] =~ SEPARATOR_PAT unless path[0, 1] == File::SEPARATOR

Now you can try out

compass watch

again and it should work.

So, let Omega 4 rock also for Windows Devs!

If you have discovered any other issues or have further recommendations please leave a message in the comments. Thanks!

Comments

pkiff’s picture

For the moment, I've decided to continue using Ruby from the Windows installer provided by rubyinstaller.org.

When using this method, you have to install bundler separately using the command:
gem install bundler

I did not get the bundler stack error you noted during gem installs, nor did get the compass error you identified. Both those are probably path/cygwin implementation issues.

I did, however, get a different error during bundle install:

Gem::InstallError: The 'oily_png' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing oily_png (1.1.0), and Bundler cannot
continue.
Make sure that `gem install oily_png -v '1.1.0'` succeeds before bundling.

I followed the directions in that error message and installed the DevKit (the installation commands are provided in the GitHub wiki note), and then re-ran bundle install and everything seems to have worked.

I'll be curious to see if not having rvm actually makes much real-world difference in the case of small-scale, single-coder, local development.

Also, it appears there is an alternative to rvm for Windows developers called "pik" and I wonder if that might be a better option than rvm via cygwin?:
https://github.com/vertiginous/pik

Added 2 May 2014:
User Stickton has written up instructions for using rubyinstaller and pik here:
Omega 4 Sass Quick Setup in Windows

fubhy’s picture

RVM is an optional wrapper around this stack. Personally I don't even use RVM but usually suggest it to people who are new in Ruby land as it allows them to play around with everything in a clean, isolated environment without hosing their global system ruby if something goes wrong. Once you master your ruby stack and understand bundler and gems all you really need is ruby, rubygems and bundler.

leolandotan’s picture

Hi fubhy, thank you and your team for Omega 4. Is there any advice/documentation you can give for a non-RVM setup and possible things to expect and avoid for beginners? Thank you.

pkiff’s picture

I would recommend following the Omega 4 Sass Quick Setup in Windows install instructions:
https://www.drupal.org/node/2204227

And if you don't need RVM, then you probably don't need pik, so you can skip step 2. Then you will use the default Ruby for Windows installer. I would recommend sticking with the latest 1.9.x version of Ruby as shown in those instructions unless you have some specific need for Ruby 2.x. There have been some issues for some users getting Omega 4.x to install easily with Ruby 2.x

You may need to tweak the gem version settings if you run into bundle install errors, but if you do, then you should post those as issues in the Omega issue queue rather than following up with further questions here in the documentation area.

LennyB’s picture

Thank you @pkiff

After spending countless hours trying to get cygwin and RVM working, I took your advice and tried a Pik setup using the instructions by Stickton.
https://www.drupal.org/node/2204227

I encountered only these 3 compilation errors
*****
error sass/mytheme.no-query.scss (Line 3 of sass/mytheme.styles.scss: File to import not found or unreadable: breakpoint
error sass/mytheme.normalize.scss (Line 8: File to import not found or unreadable: toolkit/border-box
error sass/mytheme.styles.scss (Line 3: File to import not found or unreadable: breakpoint
*****

This was easily fixed by making the changes in comments #7 and #10 here https://www.drupal.org/node/2323235

My Omega 4 and SASS is now working like a dream!

Cosmin Hodis-Mindras’s picture

OK, I got the message:

ruby-1.9.3-p484 is not installed.
To install do: 'rvm install ruby-1.9.3-p484'

...But after trying to run that command line, I get:

$ rvm install ruby-1.9.3-p484
Searching for binary rubies, this might take some time.
No binary rubies available for: cygwin/unknown/i386/ruby-1.9.3-p484.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for cygwin.
Requirements support for cygwin is not implemented yet,
report a bug here => https://github.com/wayneeseguin/rvm/issues
Requirements installation failed with status: 1.
webatelier’s picture

same problem here ...
couldn't find solution neither

Cosmin Hodis-Mindras’s picture

I managed to have everything running by skipping RVM and installing Ruby 1.9.3p448 directly using the Cygwin installer. After that I just installed the bundle gem and the rest of the installation went fine.

webatelier’s picture

thx for the advice
plz elaborate which commands you used in cygwin to install ruby and the bundle

i installed ruby manually in win7 (not through cygwin) via http://rubyinstaller.org/
but how do i install the necessary bundler then ?
or did you install ruby via cygwin ?

bundle install gives me a 'command not found'
thx for the help

pkiff’s picture

To install bundler after installing Ruby via http://rubyinstaller.org/, open up a Ruby command prompt and run
gem install bundler

When you install ruby via rvm/cygwin, bundler gets installed automatically, so this step does not appear in the main article.

The bundle install command does not install bundle itself, but it tells bundle (after you have installed it) to "install" a series of other Ruby "gems" based on details in the omega subtheme files. You will want to run bundle install from within your omega subtheme folder. See my note above if you get an error message about "oily_png" requiring "build tools".

General help with bundler, including the command used to install it, is available from the bundler website:
http://bundler.io/

milfguy’s picture

Hi Cosmin and Pkiff,

I'm at about the same level of stuck at the minute.

using via http://rubyinstaller.org/, open up a Ruby command prompt and run gem install bundler

Unfortunately you cannot install RVM if you install ruby using rubyinstaller on windows, therefore gem install bundler doesn't work. (edited - error see comment below)

Using the Cygwin lets you get a good way along the path. RVM installs, the bundle installs but as Cosmin first stated, running:

rvm install ruby-1.9.3-p484

produces this error:

$ rvm install ruby-1.9.3-p484
Searching for binary rubies, this might take some time.
No binary rubies available for: cygwin/unknown/i386/ruby-1.9.3-p484.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for cygwin.
Requirements support for cygwin is not implemented yet,
report a bug here => https://github.com/wayneeseguin/rvm/issues
Requirements installation failed with status: 1.

Cosmins fix of installing ruby through cygwin's setup.exe, does install ruby but only version ruby-1.9.3-p448.

When pointing navigating to the child theme directory in Cygwin I am prompted to update ruby to ruby-1.9.3-p484 (only the p484 changes). But I have not found a way to update to this version. Is it possible to update ruby in Cygwin in windows? I haven't found a way that works yet and have looked for 24 hours.

Ignoring this prompt in Cygwin and executing the command drush omega-guard I am prompted to update ruby gems, to 1.9 although I have rubygems 2.2 installed and activated, sometimes Cygwin doesn't give me this warning.

When Cygwin does let me run the command drush omega-guard everything happens as it should. But it gets to:

LiveReload is waiting for a browser to connect
Browser connected

and nothing else happens.

Anyone have any idea about this?

EDIT:

I completed a system restore and started from scratch to see if it was my error but I had the same thing happen. I have managed to fix my issues. This comments in this link were very useful http://precessionmedia.com/blog/install-and-run-rvm-bundler-windows-drup...

To install ruby 1.9.3-p484 I used this command:

rvm install ruby-1.9.3-p484 --autolibs=0

Initially I installed it in my omega child theme but then had issues with bundle install, these seemed to fix themselves when I reopened cygwin and repeated the ryby install in cygwin root.

Following the instructions again I still got errors when trying to peflags -X409600 which ruby but Valera's fix below (thank you!) worked after a couple of attempts copy and pasting peflags -X409600 `which ruby` exactly as it is.

Drush omega-guard isn't working for me yet but I will investigate today and report any fix I can find for that.

pkiff’s picture

Hi mil*guy,

Unfortunately you cannot install RVM if you install ruby using rubyinstaller on windows, therefore gem install bundler doesn't work.

If you choose to use rubyinstaller, then you will be using it instead of RVM, not in combination with it. The command gem install bundler works just fine on a fresh install of Ruby done via rubyinstaller.org. My suggestion to use rubyinstaller is intended as a complete replacement for all the instructions involving RVM and cygwin.

The main advantage of using rubyinstaller is that you shouldn't run into any cygwin-related errors like those you and the original poster ran into. The main disadvantage is that if you upgrade your Ruby version after creating an Omega site and then later need to go back and edit the original files (possibly with an older version of Omega), then you may find you need to uninstall Ruby and reinstall the version of Ruby that matches your original files.

Regarding LiveReload, I have had issues with this under both Omega and another Sass/Compass/bundler theme called Aurora, and I have not yet figured out whether the problem is related to Ruby or Omega or my local WAMP configuration.

milfguy’s picture

Hi Pkiff, Sorry that was my mistake, I must have been trying to install rvm in the rubyinstaller which wouldn't install and that explains why! I am very new to this style of webdesign and never used a command prompt or ruby before! I have still not had any luck with the LiveReload either and have settled for compass watch (which as far as I can tell is the same except for the auto refresh?).

jimmic’s picture

I've tried several ways but didn't work. And I finally succeeded by installing railsinstaller.
Maybe this is the easiest way for windows.
No rvm no cygwin or rubyinstaller,just railsinstaller.

Valera Tumash’s picture

As for "... stack level too deep (SystemStackError)...", the command "peflags -X409600 which ruby" gave me the following output in my cygwin Terminal:

$ peflags -X409600 which ruby
which: skipped because nonexistent
ruby: skipped because nonexistent

The solution was to change it into:
peflags -X409600 `which ruby`

hturner’s picture

It looks like rvm has been updated to work with cygwin. There is a long conversation at https://github.com/wayneeseguin/rvm/pull/2360#issuecomment-32062384.

The bottom line for me was to get the current version of rvm. Run from cygwin root,

rvm get head

and then

rvm requirements.

This would give errors like:

Error running 'requirements_cygwin_libs_install sqlite3 mingw64-x86_64-gcc'

Install any missing items (sqlite3 and mingw64-x86_64-gcc) using the cygwin setup.exe and you should get the message:

Checking requirements for cygwin.
Requirements installation successful.

From the subtheme directory, run

rvm install ruby-1.9.3-p484

I needed to run

peflags -X409600 `which ruby`

as mentioned above to increase the stack size before running

bundle install

spgd01’s picture

I get through most of the gem install with the Bundle Install comand but after about 12 gems are installed I get the "stack Level too deep" error. I ran

peflags -X409600 `which ruby`

but that only took me from no gems to about 12 gems installed. Any one have an idea how to solve this?

/ruby-1.9.3-p484@global/bin/ruby_executable_hooks:15: stack level too deep (SystemStackError)

BrianVu’s picture

Screenshot: http://vietpho.net/~images/misc2/ruby-event-machine-error.png

I've spent 2 days trying to install the bundles to no avail. Maybe someone can help me?

Update: Here's a screenshot of my latest issue installing the bundles... "Fork is already occupied"
http://vietpho.net/~images/misc2/fork-already-occupied.png

Any help with this is appreciated. Thanks!

spgd01’s picture

I had the same problem with EventMachine. I noted in the error that make: g++ Command not found. So I used cygwinsetup.exe again and used the search feature for all "g++" selected the two that where not installed and installed them. All is working now. I hope that helps.

spgd01’s picture

I ran:
peflags -x409600 `which ruby`

Not
peflags -X409600 `which ruby`

I found this:

I think Cygwin is reporting the committed (used-so-far) stack size, not the reserved (total available) size. Then Ruby is treating that (i.e. 90k) as the maximum stack size ever.

To change the initial committed stack size:

peflags -X409600 `which ruby`

Note the capitalized -X. Lowercase -x changes reserved stack size, not initially-committed stack space.

So make sure you do the capital X:
peflags -X409600 `which ruby`
Now it works

BrianVu’s picture

Hello guys,

I've got all of the Bundles to install but this is the current error I'm getting now:
http://vietpho.net/~images/misc2/fork-already-occupied.png

0 [main] ruby 8228 child_info_fork::abort: unable to remap rubyeventmachine.so to same address as parent (0x25D0000) - try running rebaseall

$ 0 [main] ruby 9072 child_info_fork::abort: address space needed by 'fcntl.so' (0x2D0000) is already occupied

0 [main] ruby 8752 child_info_fork::abort: unable to remap rubyeventmachin e.so to same address as parent (0x25D0000) - try running rebaseall

Thanks in advanced for helping!

ccmd00d’s picture

Hi, can you share how you got all bundles to install correctly without the fork issues?

mrjuggles’s picture

try this.

in your Cygwin Window

find /home/your_user/.rvm -iname '*.so' > /tmp/ruby.gems.local.so.lst
exit

go to C:\cygwin\bin and right-click run the file dash.exe as Administrator and then at the dash command prompt.

/usr/bin/rebaseall -T /tmp/ruby.gems.local.so.lst

restart your PC and then try. bundle install

Nitty-Gritty’s picture

If this doesn't work, try using an absolute path in Cygwin. For example, this worked for me using:

find c:/home/your_user/.rvm -iname '*.so' > /tmp/ruby.gems.local.so.lst

then running dash as suggested.

BrianVu’s picture

I tried to install all of this on my laptop Lenovo Z580 and the same errors (space is occupied in screenshot) are still happening.
I use XAMPP and Avira Antivirus on both computers could these be the culprit?

Edit: Ran everything in safe mode and still got the space is occupied errors :(

syam.mohan.vs’s picture

I am also getting lot of fork errors on my windows 7 machine. I ran rebaseall but it didnt help. Please help.

ccmd00d’s picture

Same here, receiving fork errors on a number of GEMS. Tried running rebaseall as administrator and no luck! Any thoughts?

syam.mohan.vs’s picture

Hi

I gave lot of time to make omega work with cygwin. Though I could make some headway I faltered at the final step that is running 'omega-guard' because of fork errors common to cygwin. Since I was not getting much support from the community on how to solve this issue and giving a lot of failed tries to eliminate the fork errors i finally gave up on this solution.

But I had to use omega 4 with all the gems that it says it provides. So I went for a virtual machine installation - virtualbox (https://www.virtualbox.org/) + bitnami drupal for virtual machines (http://bitnami.com/stack/drupal/virtual-machine). Now I have an awsome ubuntu linux environment for Drupal development + I am still working on windows. Omega 4 and all its gems installed fast and omega-guard runs without any hiccups. Drupal and omega 4 in particular seems to have a bias for linux. By setting up a linux virtual environment in your windows machine you could fasten setting up your development environment. So for me that is the way to go rather than cygwin. Hope this helps somebody.

ccmd00d’s picture

Hi Syam,

Great idea! I did the same and was able to install virtualbox, the bitnami drupal stack, installed RVM and Ruby, installed Omega 4 via drush, created a sub-theme using drush omega-wizard, completed bundle install, and finally ran drush omega-gaurd, then used samba to set up a file share and edit my sass files. And all seems to be working flawlessly! Thanks again!

The only issue i am having is with livereload where I am getting a Livereload is waiting for the browser to connect message in the terminal. I did try to update the livereload setting in the theme from localhost to my virtualbox IP, but that still does not work. Were you able to figure this out?

Best,

Derek

syam.mohan.vs’s picture

Hi Derek

Good to know that your are almost there. Live reload is working for me but I am working entirely on the virtual setup. That is my guard is running in VM as is the browser am using to see the changes.

This doesn't seem to work with a browser on my windows machine though (browser in WINDOWS and Guard in VM).

Also if you are using a shared folder then there is a post here that discusses the issue - https://drupal.org/node/2114735.

Hope this helps.

Nitty-Gritty’s picture

After entering
bundle install
I get the "stack level too deep" error:

Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...Unfortunately, a fatal error has occurred. Please see the Bundler
troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/cygdrive/c/Users/BaSe/.rvm/gems/ruby-1.9.3-p545@global/bin/ruby_executable_hooks:15: stack level too deep (SystemStackError)

but running
peflags -X409600 'which ruby'
results in
which ruby: skipped because nonexistent

Nitty-Gritty’s picture

Regarding the above, mea culpa, I was using quote apostrophe: ' instead of backticks: `.
The command given above
peflags -X409600 `which ruby`
did solve the "stack level too deep" errors for me. However, now I have "forking" errors, which I'll post a solution to here if I finally find one.

Update: a variant of mrjuggles' suggestion above did the trick for the forking errors.

The problem now is that the theme isn't compiling changes automatically (drush omega-guard doesn't seem to be working properly).

FWIW: anyone considering following the guide on this page, be warned, it may not be straightforward! From searching around trying to solve the problems on my own system I've found evidence of many people having serious problems getting this whole process to work on Windows.

sukh.singh’s picture

I followed the instruction as mentioned above, however I am getting following error.

An error occurred while installing ffi (1.9.3), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.3'` succeeds before bundling.

The details of the log is here http://pastebin.com/0bJ7JREy

RyanJ_DMC12’s picture

I went to my subtheme's root directory in Cygwin and RVM told me to install ruby 1.9.3-p547 so I did and everything went as normal however when I try and run omega-guard in Drush I get prompted that "You have to install Ruby version 1.9 or newer." I'm guessing I missed something really simple but not sure what I could have missed from the tutorial. Has this happened to anyone else?

littledynamo’s picture

Done, dusted and working nicely in 5 mins flat. http://railsinstaller.org/en

Delty’s picture

Excellent alternative - had it running in ~5 mins without Cygwin!

VVVi’s picture

If you get an error like this (while installing the eventmachine gem):

make
compiling binder.cpp
make: g++: Command not found
Makefile:198: recipe for target 'binder.o' failed
make: *** [binder.o] Error 127

make failed, exit code 2

Gem files will remain installed in /home/Zach/.rvm/gems/ruby-1.9.3-p547/gems/eventmachine-1.0.3 for inspection.
Results logged to /home/Zach/.rvm/gems/ruby-1.9.3-p547/extensions/x86_64-cygwin/1.9.1/eventmachine-1.0.3/gem_make.out
An error occurred while installing eventmachine (1.0.3), and Bundler cannot
continue.
Make sure that `gem install eventmachine -v '1.0.3'` succeeds before bundling.

then rerun cygwin setup and enable the gcc-g++ package. (I replaced gcc with gcc-g++ in the documentation.)

JussaguyDesign’s picture

I have been trying to successfully install RUBY, Bundler and then run the "drush Omega Guard" for days and I finally figured it out! Better late then never.

WINDOWS 7 32 bit:

First, you do NOT need cygwin or RVM to get it to work. The issue is with the newer versions of RUBY. Long story short, you must use RUBY 1.9.3. Follow the direction below:

1.) Download and install RUBY 1.9.3 from the http://rubyinstaller.org/downloads. (If you have a newer version of RUBY installed, be sure to uninstall it first)

2.)While you are at http://rubyinstaller.org/dowloads, grab the DevKit 7zip file. Be sure to get the correct version for RUBY 1.9.3. After you have placed you DevKit somewhere permanent, (FOLLOW THE DIRECTIONS for the DevKit here, https://github.com/oneclick/rubyinstaller/wiki/Development-Kit#building-...). Just start at "Installation Instructions".

3.)In the Ruby cmd, run gem install bundler. (FOR SOME REASON, I HAD TO INSTALL EACH GEM individually, it was about 47 of them. Didn't take that long, 20mins)

4.) Run Ruby cmd command, "drush omega-guard"

pkiff’s picture

The instructions on this page are aimed specifically at those who want or need RVM on their Windows machine configured for Omega 4 development.

If you don't want or need RVM, then I would recommend following the Omega 4 Sass Quick Setup in Windows instructions, which use rubyinstaller 1.9.3 to start off, just like you are recommending. You should not have to install each gem individually following those instructions.

JussaguyDesign’s picture

Sorry, I didn't realize these instructions were for RVM on WIN specifically. I thought they were for getting RUBY and "omega-guard" to work.

I think I had a unique situation with installing the GEMs individually. The bundle install commancd worked when I had the newest version of RUBY, but for some reason that command did NOT work with RUBY 1.9.3. It gave me an error and instructed me to make sure each GEM was installed before running bundle install command. Weird.

No big deal though, I was able to get everything working. Personally, I was just trying to get Omega 4 installed and wanted to use the SASS features. Everything seems to be working fine so far. THANKS.