For those of you who prefer Windows as your development environment, yet are NIX-inclined, here is a way to install Ruby on Rails for development & testing use under Cygwin.
When you’re done, all your command prompt work can be done under Cygwin.
At the time of this writing, Cygwin includes Ruby 1.8.4 and MySQL is on verison 5.0.
For an alternative using SQLite3 see RailsOnWindowsCygwinWithSQLite3.
(Note: I just went through this and didn’t find all the issues covered in one place, so I put this together. Feel free to refactor, I’m a bit of a rails noob.)
Run Cygwin’s setup.exe as normal (for expanded install instructions, see below). From the package list, under Dev, make sure to choose:
You’ll be using gcc to build the Cygwin version of MySQL, even though you will not be running it (see below).
Just download MySQL 5.0 Windows Installer. I used the full version as opposed to the Essentials version.
This will install MySQL as a Windows service, meaning it will be running full time. Follow the installation wizard for security settings, etc.
This is at the bottom of the page and is labeled Tarball.
Extract the tarball into a tmp directory and do the normal Linux things:
./configuremake installThis will take a bit. You’re compiling MySQL 5.0 for use under Cygwin. You’re not going to run this version, but you need it around, especially the source, in order to build the Rails MySQL connector below.
Do this the normal way. Download Gems and do the normal extraction and then execute ruby setup.rb
Now that you have Gems, you can install Rails. Execute gem install rails --include-dependencies
If you are behind a proxy, use -p (for full documentation, see the GEMS Manual). This applies to step 6 below as well.
since Rails 2 is out, I find that adding —version 1.1.6 to this command is important
Execute gem install mysql. When prompted for the choice, do NOT install the mswin32 version. Install the latest unix version.
That’s it. Ruby scripts, Rails commands, and connections to MySQL should now work.
For those of you new to rails, cygwin is VERY helpful, since Winblows isn’t the greatest environment for development (also, I’m too poor to buy a Mac and my HD can’t hold a linux partition… woe is me.) Here is the straightforward way to do this:
C:\cygwinsetup.exe to this new folder.C:\Program Files\cygwin-files as my folder, but it don’t matta./cygdrive/c automatically.Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (during rake db::migrate, for example), you need to force access to the MySQL server via IP. In your database.yml[database.yml], change all occurances of localhost to 127.0.0.1.ruby setup.rb and you get a complaint like:ruby: No such file to load -- ubygems (LoadError)unset RUBYOPT Then run the gem installer again. That should fix it! (Thanks to PluitSolutions for the tip)> rails dummy_app "No such file or directory" - /dev/urandomFor those of you who prefer Windows as your development environment, yet are NIX-inclined, here is a way to install Ruby on Rails for development & testing use under Cygwin.
When you’re done, all your command prompt work can be done under Cygwin.
At the time of this writing, Cygwin includes Ruby 1.8.4 and MySQL is on verison 5.0.
For an alternative using SQLite3 see RailsOnWindowsCygwinWithSQLite3.
(Note: I just went through this and didn’t find all the issues covered in one place, so I put this together. Feel free to refactor, I’m a bit of a rails noob.)
Run Cygwin’s setup.exe as normal (for expanded install instructions, see below). From the package list, under Dev, make sure to choose:
You’ll be using gcc to build the Cygwin version of MySQL, even though you will not be running it (see below).
Just download MySQL 5.0 Windows Installer. I used the full version as opposed to the Essentials version.
This will install MySQL as a Windows service, meaning it will be running full time. Follow the installation wizard for security settings, etc.
This is at the bottom of the page and is labeled Tarball.
Extract the tarball into a tmp directory and do the normal Linux things:
./configuremake installThis will take a bit. You’re compiling MySQL 5.0 for use under Cygwin. You’re not going to run this version, but you need it around, especially the source, in order to build the Rails MySQL connector below.
Do this the normal way. Download Gems and do the normal extraction and then execute ruby setup.rb
Now that you have Gems, you can install Rails. Execute gem install rails --include-dependencies
If you are behind a proxy, use -p (for full documentation, see the GEMS Manual). This applies to step 6 below as well.
since Rails 2 is out, I find that adding —version 1.1.6 to this command is important
Execute gem install mysql. When prompted for the choice, do NOT install the mswin32 version. Install the latest unix version.
That’s it. Ruby scripts, Rails commands, and connections to MySQL should now work.
For those of you new to rails, cygwin is VERY helpful, since Winblows isn’t the greatest environment for development (also, I’m too poor to buy a Mac and my HD can’t hold a linux partition… woe is me.) Here is the straightforward way to do this:
C:\cygwinsetup.exe to this new folder.C:\Program Files\cygwin-files as my folder, but it don’t matta./cygdrive/c automatically.Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (during rake db::migrate, for example), you need to force access to the MySQL server via IP. In your database.yml[database.yml], change all occurances of localhost to 127.0.0.1.ruby setup.rb and you get a complaint like:ruby: No such file to load -- ubygems (LoadError)unset RUBYOPT Then run the gem installer again. That should fix it! (Thanks to PluitSolutions for the tip)> rails dummy_app "No such file or directory" - /dev/urandom