Translations of this page?:

You can also choose to install Ruby on Rails on cygwin. There are some benefits since cygwin acts a bit like linux/mac environment on PC.

Get Cygwin

  1. Choose a cygwin root directory. (default: c:\cygwin)
  2. Choose a local package directory. (example: c:\cygwin-files)
  3. Make sure you select the following packages:
    • Interpreters → ruby
    • Devel → git, git-completion, gitk
  4. Additionaly, you might also choose to install:
    • automake, make, ImageMagick, openssh, gcc, gcc-g++, vim, and ping.
  5. Install the packages and finish the installation.

Configuring .bashrc

As with Linux, you can put some aliases in your /home/your_username/.bashrc to have them available at all times. Here are some examples:

  # Shorten commonly used commands
  alias srv='script/server'
  alias mig='rake db:migrate'
  alias log='tail -f log/development.log'
  # Mount custom directory to your cygwin environment
  # You can then access these directories using cd /rails and open one by default
  mount -f -u -b "C:\MyRailsProjects" "/rails"
  cd /rails

If you're using e-Texteditor you can also put this in your .bashrc to simplify opening projects:

  alias e='cygstart e'

Now you can use “e .” inside your /rails/myapp directory to open it as a project.

Console2

Using http://sourceforge.net/projects/console/ is a great way to manage multiple cygwin consoles. Install Console and set it up to open cygwin by default. You can also skip this step and use the default cygwin console.

You'll want to setup cygwin as a Console Tab. Go into the settings and click “Add” under “Tabs”. Use the following as the “Shell”.

  c:\cygwin\bin\bash --login -i    

If you want it to automatically open cygwin when you start Console, move it to the top of the Tabs list.

Install RubyGems

Grab the latest rubygems from Sourceforge. Save the file into your home directory (c:\cygwin\home\your_username\). Extract the archive and install rubygems using:

  tar xvfz rubygems-1.3.1.tgz
  cd rubygems-1.3.1
  ruby setup.rb

Install Rails

Now that you have RubyGems installed you can install Rails using

  gem install rails

Follow other tutorials for installing additional gems.

Resources

 
getting-started/installation/cygwin.txt · Last modified: 2009/02/12 06:21 by danabrit
 
Recent changes RSS feed Creative Commons License