- Open powershell and check if the ruby is installed in your system by typing the ruby -v command.
If you get the message above, that means you don’t have Ruby installed and you need to install it.
Note: For applications requiring rails 6.x, you need the ruby version above 2.5
2. To install ruby on a windows machine, go to rubyinstaller.org and click on it to download.
3. Once download completes, click on the downloaded file and go through the installation process. Most default installation options (pre-selected) are good. In one of the options you might get the option to download and install the MSYS2 and development toolchain, make sure you have that checked to download and install it.
While installing, when it command prompt pops up, hit enter
After installation is complete, restart the powershell and rerun ruby -v command. It should be showing you the version you installed.
You now have the Ruby programming language installed and working perfectly.
Next Step: Install NodeJS and Yarn
- To see if you have node already installed, pull up a PowerShell window and type in node — version followed by enter.
If you get an error message like above, then you will need to install node.
2. To install NodeJS, go to nodejs.org and click on the Download button.
3. Once downloaded, click on the downloaded file and click through the installation options. Leave all the installs to default options.
After installation is complete, restart the powershell and rerun node — version command. It should be showing you the version you installed.
- You can check for an existing installation of Yarn by checking the yarn version in your PowerShell window.
- To install yarn for Windows, head over to the yarn (classic) installation page: https://classic.yarnpkg.com/en/docs/install#windows-stable
- Click on the download button and install after download is complete.
- Once installed, re-start your PowerShell window and check for the yarn version using yarn — version.
- You now have NodeJS and Yarn (dependencies of Rails) successfully installed.
Next step: Install Rails
When we are talking about ruby, the ruby gems play a major role. Rails itself is a rubygem hosted in rubygems.org.
- Before we install rails gem, we make sure we install bundler. To install bundler simply type gem install bundler .
note: If you want specific version of bundler, then type gem install bundler -v 1.17.3
3. Install rails using gem install rails
4 Once successfully installed, you can check for the version of rails that’s installed by typing in the rails -v command followed by enter
Last step: Test
- Now that we have rails installed, let’s use it to create a new rails application. You can do it by using the following
rails new test_app
2. You should now be in the test_app folder. This is your newly created rails application.
3. start rails server
4. Hit localhost:3000 in the browser and you see this result
You have now successfully installed Rails on your windows machine.