Computersnyou

How To Install Ruby On Rails On Windows [ tutorial ]

Posted on  7/5/2012

In this tutorial I’ll show you how to install ruby on rails on windows .just follow these steps , to get up and running rails on windows .

Steps

1 : first  download ruby installer for windows  from  :  http://rubyinstaller.org/
and download DevKit from http://rubyinstaller.org/add-ons/devkit/
and extract and run the post install script from post-install directory

 

ror2

 

I’ll use Ruby1.9.3-p194

check box ( Add Ruby Executable to your path ) when installing  Ruby , that will add ruby on your PATH .

2 : verify installation open CMD and type

ruby -v

 

3: after that check gem version and if it needed update gems

gem -v 

gem update —system

<div>
  <div>
    <a href="/wp-content/uploads/2012/07/ror.png"><img class="aligncenter wp-image-5946 size-full" src="/wp-content/uploads/2012/07/ror-e1499490300180.png" alt="" width="600" height="336" /></a>
  </div>
  
  <div class="separator" style="clear: both; text-align: center;">
  </div>
</div>

<p>
  &nbsp;
</p>

<p>
  4 : install rails gem
</p>

<pre>gem install rails</pre>

<div>
</div>

<div>
  5: install SQLite 3 because Rails  uses SQLite3 as a default  Database
</div>

<div>
  <pre>gem install sqlite3</pre>
  
  <div>
    6:  install mysql gem
  </div>
  
  <div>
  </div>
</div>

<div>
  <pre>gem install mysql</pre>
  
  <pre>#In case of problem 

gem install mysql –platform=ruby — –with-mysql-dir=C:\mysql  

  <p>
    or change the directories path according you MySQL installation
  </p>
  
  <p>
    download c connector from here
  </p>
  
  <p>
    <a href="http://dev.mysql.com/downloads/mirror.php?id=377977">http://dev.mysql.com/downloads/mirror.php?id=377977</a>and extract  <code>/lib/libmysql.dll</code>  into your <code>c:rubybin</code>  folder
  </p>
</div>

<p>
  <a href="/wp-content/uploads/2012/07/mysql.png"><img class="aligncenter wp-image-5945 size-full" src="/wp-content/uploads/2012/07/mysql-e1499490337124.png" alt="" width="650" height="447" /></a>
</p>

<div>
  <div>
  </div>
  
  <div>
    7 : install git . for version control and code tracking  download windows version from here
  </div>
</div>

<div>
  <a href="http://git-scm.com/downloads">http://git-scm.com/downloads</a>
</div>

<div>
</div>

<div class="separator" style="clear: both; text-align: center;">
  <a href="/wp-content/uploads/2012/07/json.png"><img class="aligncenter wp-image-5944 size-full" src="/wp-content/uploads/2012/07/json-e1499490375242.png" alt="" width="800" height="513" /></a>
</div>

<div>
  8 : create new rails app
</div>

<div>
  <div class="separator" style="clear: both; text-align: center;">
  </div>
  
  <ul style="text-align: left;">
    <li>
      <b><i style="background-color: #cccccc;">rails new demo_app </i></b>
    </li>
    <li>
      if you are getting<b><i> Gem::InstallError: The &#8216;json&#8217; native gem requires installed build tools.</i></b>
    </li>
    <li>
      <b><i>don&#8217;t panic just add devkit in your environment PATH  </i></b>
    </li>
    <li>
      add<b><i> c:devkit </i></b> in your environment PATH and open CMD and type<b><i> <span style="background-color: #cccccc;">gem install json -v &#8216;1.7.3&#8217;</span></i></b>
    </li>
    <li>
      if it fail to install install it from using <b><i style="background-color: #cccccc;">C:devkitmysys.bat</i></b>
    </li>
    <li>
      type <b><i style="background-color: #cccccc;">rails -s </i></b>
    </li>
    <li>
      open browser and navigate to <b><i style="background-color: #cccccc;">http://localhost:3000 </i></b>
    </li>
  </ul>
  
  <div>
    <a href="/wp-content/uploads/2012/07/localhost.png"><img class="aligncenter size-full wp-image-5942" src="/wp-content/uploads/2012/07/localhost.png" alt="" width="640" height="499" srcset="/wp-content/uploads/2012/07/localhost.png 640w, /wp-content/uploads/2012/07/localhost-300x234.png 300w" sizes="(max-width: 640px) 100vw, 640px" /></a>
  </div>
  
  <div>
    Enjoy Riding!
  </div>
</div>

  • Home
  • About