A guide to install Ruby on Windows 10 for your development environment.
If you would like to install ruby with an Windows Installer then you can download this installer and install ruby on windows 10. Easy way! But in this guide you learn to install Ubuntu as sub system on Windows 10 without affecting the existing OS.
- Check the Windows Version
- Turn on the Windows Feature – “Windows Subsystem for Linux”
- Turn ON Developer Mode
- Download ‘Ubuntu’ from the Windows App Store
- Open the bash command and your Ubuntu is ready
- Install the Prerequisite libraries
- Install Ruby with RVM
Step 1: Check the Windows Version
First thing to do is to check what is your Windows Build version number from below two options. You can try any one of it.
1.1: Check your System Build Number:
To check your Windows Build number, Open
Settings > System > About
Check the two Fields OS Build and System Type
1.2: Run the Command on the Power shell:
You can run the below command in the Powershell to see the OS name and OS Version of your System. This command will show the Build of your Windows too.
systeminfo | Select-String "^OS Name","^OS Version"
Step 2: Turn on the Windows Feature – “Windows Subsystem for Linux”
Enable the “Windows Subsystem for Linux” feature using the windows feature turn on and off option and then reboot the system.
Turn this feature “Windows Subsystem for Linux” ON.
Click on “OK” button and then system will reboot to install the update.
Step 3: Turn ON Developer Mode
Open Settings > Update and Security > For developers
Check the Developer Option
Step 4: Download ‘Ubuntu’ from the Windows App Store
Goto Microsoft Store and Search for word “Linux“. You will find many Linux version based apps but search for ‘Ubuntu’ and open it.
Install the Ubuntu Linux Distribution from the Microsoft Store.
Step 5: Open the bash command and your Ubuntu is ready
After you have installed the Ubuntu app from the Microsoft Store, Bash command window will open and ask for Username and password.
Congratulations you now have Linux environment on Windows 10. With this Linux environment we can now install Ruby and other libraries.
Step 6: Install the Prerequisite libraries
First make sure all the software are updated on latest version by running the below commands. This will take some time to update the software.
sudo apt-get update && sudo apt-get -y upgrade
Then install the required libraries like curl and build essentials
sudo apt-get install curl build-essential gnupg
Now, install Ruby Version Manager (RVM) which is a tool for installing and managing multiple Ruby versions.
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
Change the directory to tmp so that we have the write access.
Download the rvm and install the stable version.
sudo curl -sSL https://get.rvm.io | bash -s stable
select the rvm. /home/railsplace/ change the ‘railsplace‘ to the username.
Step 7: Install Ruby with RVM
This step is to install Ruby with Ruby Version Manager (RVM)
Show all the Ruby Version available that can be install with RVM
rvm list known
Install the latest Ruby Version
rvm install ruby
rvm --default use ruby
You can even install a specific version of Ruby
rvm install ruby-X.X.X
rvm --default use ruby-X.X.X
Check the Ruby Version
Install the Bundler
gem install bundler --no-rdoc --no-ri
Once all the above libraries are installed then you can run “irb” to test if the ruby code is working. If you see the output as I see then Congratulations and Welcome to Ruby. You can now start writing Ruby and execute it.
Hope you have enjoyed the guide. If you have any issues during installation or need help. Then please feel free to comment below or drop us email at email@example.com