How to Install Ruby on Rails in Windows

How to install ruby on rails in windows

Follow those steps, actually, I have installed Ruby on Rails to many windows machine using these steps.

Step 1: Download Git BASH as the BASH emulation behaves just like the "git" command in LINUX and UNIX environments.

Step 1.1: Download and install latest NodeJS from here and check the NodeJS version

$ node -v
#=> v6.11.5 # or something like this

Step 2: Download the ruby latest version here and install it in your directory. Check the Ruby version

$ ruby -v
#=> ruby 2.3.1p112 (2016-04-26 revision 54768) [x64-mingw32]
# or something like this

Step 3: Download Devkit here take the suitable one for matching your windows bit like 32 or 64 bit

Step 4: Create a devkit folder inside Ruby directory that means where created a default directory after installing ruby software, something like this disk (:C) or (:D)/Ruby25/devkit/

Step 5: Extract the DevKit file inside the devkit folder

Step 6: Open your GIT BASH inside the devkit folder and run this two commands

$ ruby dk.rb init
$ ruby dk.rb install

if above command running properly then done.

Step 7: Now you can run rails command for installing inside ruby folder

 $ gem install rails

Step 8: Check the Rails version

 $ rails -v
#=> Rails 5.0.6

if till now all are steps is ok? that's it, now run rails command and create a rails project, like

$ rails new project
create
create README.md
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/config/manifest.js
............

Hope it helps

How to install Ruby on Rails on Windows?

Complete Installation process and set environment on windows and set git configuration:

step 1:
Download links:

A. ruby on rails: visit http://railsinstaller.org/en
and download

B. nodejs: visit
https://nodejs.org/download/ and download

  1. run and install railsinstaller.exe

2.run and install node.exe (optional)

step 2: set environment path:

a. go: my computer > properties

Sample Image

b. Then Advanced system settings
Sample Image

c. Then Environment Variables
Sample Image

d. Then Edit (here you need to edit path)
Sample Image

e. add C:\nodejs; to path

Sample Image

Test:
1. Restart your pc (optional)
2. open your terminal (Git Bash or cmd )
3. type & hit enter:

ruby -v
rails -v
git --version
node -v

Sample Image


  1. if you see the versions that means everything ok.

You can Set git configuration:

$ git config --global user.name "your github username"
$ git config --global user.email email@example.com

if you want to set github ssh you can see
Generating SSH keys

if you want to install mysql and gem 'mysql2' see here

if you want to install postgresql and gem 'pg' see here

install ruby on rails on windows

I have to code on Windows at work and deploy to Linux and this is what I use

  1. Ruby installer
  2. Ruby Dev Kit
  3. Install Rubygems
  4. Open a Ruby command prompt for the next steps
  5. gem install bundler
  6. bundle install mysql
  7. bundle install rails
  8. Go to the directory you want to house your rails apps (e.g. cd \rails_source)
  9. rails new (inserting the app name you want)
  10. Once that is done, cd into the directory
  11. Edit Gemfile to ask for gem 'mysql'
  12. cd Config
  13. edit Database.yaml to look for mysql db
  14. cd ..
  15. create a db for your mysql instance called _development
  16. Go back to rails command line
  17. bundle exec rails g scaffold (like blog_entry)
  18. bundle exec rake db:migrate
  19. bundle exec rake routes
  20. Look for your desired route in the output
  21. bundle exec rails s
  22. Open a browser
  23. Go to http://localhot:3000/
  24. You should see a plain app

You can also check out Rails for Zombies which is a visual tutorial. It is not windows oriented but it helps fill in the gaps

Complete Steps Install Ruby on Rails on Windows

I don't know about Windows 10, but we have it working on Windows 7.

Sample Image

Here are the steps on how to do it:

  1. Install Ruby
  2. Install RubyGems
  3. Download & install Rails through RubyGems
  4. Install any third-party dependencies (ImageMagick & MYSQL2 can take some time)

Here are the specifics:

Installing Ruby is the most difficult part on Windows, mainly because you have to compile it before installing.

There are tools which have done this for you, including RubyInstaller and RailsInstaller:

.....

If you're a total newbie, especially to compiling in Windows, you'll want to use one of the above. If you fancy the challenge, you could compile Ruby yourself with Makefile.

--

After you've got Ruby onto your system, you then need to get RubyGems. This should work pretty straightforwardly, although it may be the case that you'll have to play around with your system's settings to get it working properly.

Here is a good tutorial:

....

RubyGems is simply a way to connect Ruby with any of the "gem" depositories which are available. Gems are basically "plugins" / "libraries" / "dependencies" for your Ruby install, allowing you to call them in applications.

Rails is a gem.

If you therefore want to install Rails, you need to be able to get RubyGems working.

After that, you'll be able to download and install Rails, which can be done as simply as typing gem install rails in your cmd.

--

After that, you'll be able to add extra dependencies to your system, such as ImageMagick or Mysql2 to get Rails working with external resources.

This is the really tricky part on Windows, as since it's built with MinGW32, many of the core components of Ruby/Rails have to be built independently.

Ubuntu/Mac are preferred OS's for many developers simply because they support most dependencies out of the box.

How do I install Rails on Windows 10?

Historically it's been pretty complicated, but on Windows 10 it's actually really simple. Just go here, and download your preferred edition of Ruby. It's a really straightforward installation process. At the end just check your Ruby and Rails versions to make sure everything's properly installed. I'm not sure if this is the "official" way, but it works and it's really simple.

I installed Ruby on Rails on Windows10 but WSL doesn't see installation

You need to install it all on WSL, I recommend you to follow the GoRails guide to install Ruby & RoR on windows 10

The Guide

can't install ruby with rvm on windows11 wsl

Solution i used

i ended up upgrading wsl to wsl 2
using wsl --set-version Ubuntu-18.04 2 from a powershell terminal

i had to delete the corrupted ruby files for this to work but the first run gave me the location of the files. and a couple of rm -rf <corrupted folders> allowed the process to complete.

Be warned this is a relatively long process took me approx 15mins per run.

after the process i was able to run the install of ruby 3.0.0 with no problem.

thank you NotTheDr01ds for putting me on track with a solution



Related Topics



Leave a reply



Submit