Screencast: Setting up under Windows
NOTE: Rails 2.3.3 only: Note specification of version number in gem install below; for more information, see https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3144-undefined-method-for-string-ror-234
For Windows, the fundamental requirements for the course are Ruby 1.9.1, Sqlite3 3.6.17, Cygwin (latest), and Ruby on Rails 2.3.3. Assignment 0 has the full list.
LAST MINUTE NOTE: When you are picking packages during Cygwin setup, please also pick “git”. This is not in the screencast, but you would do this in the same UI where you are selecting ssh and zip.
If you intend to watch the screencast, I’d suggest that you print out this page and follow along. To watch, click: http://e168f09.plugh.org/extras/screencasts/windows-setup.html
To set up under Windows, you’ll need to:
- Install Ruby 1.9 with the Windows One-Click Installer. As of 16-Aug-2009, the best version for 1.9 is “Preview2,” at http://rubyforge.org/frs/?group_id=167&release_id=38052.After installing Ruby 1.9, you will need to put C:\ruby19\bin into your system’s path.To add a directory to your path: Click “Start,” then “Control Panel.” In newer versions of Control Panel, you click “Performance and Maintenance,” and then “See basic information about your computer.” On older versions of the Control Panel (the “classic view”), you click the “System” icon. Now you should se a panel titled “System Properties.” Pick the “Advanced” tab, then click the “Environment Variables” button. Go down to “System variables,” and select “Path.” Click the “Edit” button. Now, for the “Variable value,” go to the beginning of that input field, and type: “C:\ruby19\bin;” (without the quotation marks — and make sure to include the semi-colon, which is used to separate entries in your path. Now click OK, OK, and OK.For those already using Ruby: If you already have Ruby 1.8.6 or 1.8.7 installed on your Windows machine, notice that the one-click installer puts Ruby 1.9 into the directory C:\ruby19. It shouldn’t conflict with your existing setup; the current version of Ruby you’ll get will depend on how your PATH is set. Gems are maintained separately for each version of Ruby.To verify:
ruby -v
You should see a summary of the version of your Ruby installation:
ruby 1.9.1p243 (2009-07-16 revision 24175) i386-mingw32
- You will need to install Sqlite3 from http://sqlite.org/download.html. See “Precompiled Binaries for Windows.” In addition to the main program in file sqlite-3_6_17.zip, you will also want the DLL in file sqlitedll-3_6_17.zip. So, download both, unzip, and put the contents into, for instance, C:\sqlite-3_6_17.As for Ruby, you should put the directory C:\sqlite-3_6_17 into the system path.To verify:
sqlite3 -version
To exit from Sqlite3, press control C.
- Additionally, you should install Cygwin (http://www.cygwin.com/). Cygwin provides a Unix emulation layer for Windows.When you install Cygwin, make sure to include the packages for zip (you will need this even if you have a Windows-based Zip program), and openssh. For these additional components, you will see them if you click the “View” button until it says “Full” next to it, and then change the “Skip” icon until it shows a version number. Zip is under the name “zip: Info-ZIP compression utility.”The Cygwin bin directory (by default, C:\cygwin\bin) should go in your path.NOTE: The names of some Cygwin utilities (for example, find) conflict with Windows programs that do similar things. If things start to behave unexpectly, remove the Cygwin bin directory from your path. You might consider putting selected programs (such as zip) into the Ruby bin directory or someplace else on your PATH.To verify:
zip --help
- Finally, install Rails and the Sqlite3 gem:
gem install rails -v 2.3.3 gem install sqlite3-ruby
To verify:
See the very end of the screencast for a quick demo of creating a Rails application and then browsing into it.
Note that the screencast is a bit out of date from the text above. Specifically, the screencast does not include the "-v 2.3.3" argument. I entered what I saw in the screencast ("gem install rails sqlite3-ruby") and got Rails 2.3.4 instead. I think I got it rolled back with a "gem uninstall", but it's a subtle difference. I didn't notice it until loading localhost:3000 and examining components.
Hmm, good point. What is especially weird is that the latest gem one gets by default on the Mac is 2.3.4.
We may adjust the gem version for Rails later on, so don't worry too much about this -- I may send an e-mail to everyone with a clarification.
Looks like Rails 2.3.4 was released today: http://weblog.rubyonrails.org/2009/9/4/ruby-on-rails-2-3-4
right after some of us installed Rails, but before everyone had.
I have everything working under command prompt, but whenever I am trying to do something like gem --help in cygwin i am getting this error:
$ gem --help
c:\School\Ruby19\bin\ruby.exe: No such file or directory -- /cygdrive/c/School/Ruby19/bin/gem (LoadError)
even though I believe I have everything in place:
$ ls -ltr /cygdrive/c/School/Ruby19/bin
total 4912
-rwxr-xr-x 1 dudina Domain U 312 Jul 15 22:18 setrbvars.bat
-rwxr-xr-x 1 dudina Domain U 1506304 Aug 15 18:12 msvcrt-ruby191.dll
-rwxr-xr-x 1 dudina Domain U 435253 Aug 15 18:24 rubyw.exe
-rwxr-xr-x 1 dudina Domain U 435253 Aug 15 18:24 ruby.exe
-rwxr-xr-x 1 dudina Domain U 59904 Aug 15 18:24 zlib1.dll
-rwxr-xr-x 1 dudina Domain U 177 Aug 15 18:24 testrb.bat
-rwxr-xr-x 1 dudina Domain U 247 Aug 15 18:24 testrb
-rwxr-xr-x 1 dudina Domain U 177 Aug 15 18:24 ri.bat
-rwxr-xr-x 1 dudina Domain U 73 Aug 15 18:24 ri
-rwxr-xr-x 1 dudina Domain U 177 Aug 15 18:24 rdoc.bat
-rwxr-xr-x 1 dudina Domain U 410 Aug 15 18:24 rdoc
-rwxr-xr-x 1 dudina Domain U 114688 Aug 15 18:24 pdcurses.dll
-rwxr-xr-x 1 dudina Domain U 232960 Aug 15 18:24 libssl32.dll
-rwxr-xr-x 1 dudina Domain U 978432 Aug 15 18:24 libiconv2.dll
-rwxr-xr-x 1 dudina Domain U 1177600 Aug 15 18:24 libeay32.dll
-rwxr-xr-x 1 dudina Domain U 177 Aug 15 18:24 irb.bat
-rwxr-xr-x 1 dudina Domain U 318 Aug 15 18:24 irb
-rwxr-xr-x 1 dudina Domain U 62464 Aug 15 18:24 gdbm3.dll
-rwxr-xr-x 1 dudina Domain U 177 Aug 15 18:24 erb.bat
-rwxr-xr-x 1 dudina Domain U 4406 Aug 15 18:24 erb
-rwxr-xr-x 1 dudina Domain U 177 Aug 15 18:25 gem.bat
-rwxr-xr-x 1 dudina Domain U 571 Sep 4 13:33 gem
-rwxr-xr-x 1 dudina Domain U 399 Sep 8 10:28 rake
-rwxr-xr-x 1 dudina Domain U 159 Sep 8 10:28 rake.bat
-rwxr-xr-x 1 dudina Domain U 401 Sep 8 10:29 rackup
-rwxr-xr-x 1 dudina Domain U 161 Sep 8 10:29 rackup.bat
-rwxr-xr-x 1 dudina Domain U 403 Sep 8 10:30 rails
-rwxr-xr-x 1 dudina Domain U 160 Sep 8 10:30 rails.bat
have anyone had this issue?
You're checking your gems from within bash.
Try doing it from the regular Windows command prompt.
We're only using Cygwin to support zip, ssh, and git. If you want to use Ruby from with Cygwin (bash), you would need to compile Ruby under Cygwin, and I don't recommend that at this point.
In a week or so I'll say a word or two about editors and IDE's, and will then suggest why you might want to compile Ruby under Cygwin, but let's leave that for later.
oh ok :)
my Win command prompt is working fine ty vm for your response:)
@Lesha
Don't use "gem" use "gem.bat" in the cygwin console and problem solved! :)