How To Install Ruby On Windows 8
π How To Install #RubyonRails π on Windows vii/8/10/11 β Tutorial 2022
Pace-Past-Step Tutorial on How To Install Ruby-red, Rails, RubyGems, Git, RMagick, MYSQL2 & SQLite3 on Windowsβ¦
Article revised on π Jan 2022 π to reflect the new update
of RubyInstaller2 (Devkit no longer required), Track 6.0.3 & SQLite3 1.iv.0.
Overview
To develop Rails on Windows, y'all require the following components:
- πCerise
- π¨ Build Tools (used for precious stone compilation)
- π RubyGems
- π Rail
- π¦ GIT
- π» IDE (Code Editor)
These are all freely bachelor, and are required for any OS Ruby install β΄
β
π Annotation from the writer (Jan 2022)
Every bit far equally I am enlightened, this is the But Ruby/Track on Windows tutorial which doesn't crave the installation of Bash. The bash dependency is around 215mb+ of unnecessary information, not worth information technology.
This tutorial explains the most space-efficient way of installing a pre-compiled version of Ruby, which but requires effectually 5mb of data + your bundles.
β
If yous accept whatever questions, please either leave a response here, or contact me directly at rpeck@frontlineutilities.co.uk.
πRubyπ
On Windows, you need a pre-compiled version of Cerise.
On Linux, you can compile from source. Non Windows.
Well, really you can. But it requires MASSIVE amounts of patience in order to get the correct dependencies / libraries installed.
The best affair to do is download a pre-congenital version of Ruby.
This can exist washed with two packages β RailsInstaller / RubyInstaller:

You should **Not** apply RailsInstaller β But RubyInstaller .
β οΈ RailsInstaller does *Not* keep libraries up to date ... β οΈ
β
πΎ Download RubyInstaller (Important)
The all-time matter to exercise is to download the ZIP version of RubyInstaller. Whilst there is an installer, it'due south better to just download the binaries in the Nothing.
If you do desire to do this, there are several options:
-
Ruby 2.3.x
(non worth bothering with) -
Ruby-red 2.iv.10
-
Red 2.5.x
-
Blood-red 2.half-dozen.x
Due to different build requirements, Blood-red 2.iv.10
started using RubyInstaller2
(which uses MSYS2 over DevKit):
I would personally recommend downloading Cherry-red 2.v.x
(the latest), but if you have an awarding designed for Ruby 2.four.10
yous're also able to use that:
1οΈβ£ Place Windows Architecture
The first pace is to know your Windows version (x64
or x86
):
- Press
Windows
+R
keys on the keyboard - Type
dxdiag
and printingOK
- Identify the
System Type
from the list:
2οΈβ£ Download Nix From RubyInstaller (may need to install 7Zip):
3οΈβ£ Save The Zip To Your Hard Drive
4οΈβ£ Unzip To PERMANENT Binder:
5οΈβ£ Add together to PATH:
The Windows PATH allows your organisation to load applications be referencing their name. To call ruby
from CMD, you'll need to add together it to the PATH
var:
β Windows 7
- Click on
First
- Right-click on
Computer
β selectProperties
- From the
Arrangement
dialogue, selectAdvanced System Settings
:
- Select "Advanced" tab β "Surroundings Variables":
- From here, select the
PATH
variable from theSYSTEM Variables
console, and selectEdit
:
When the "path" variable setting loads, paste the path to the /bin
directory of Carmine into it (keeping the other paths intact). Subsequently this, click "OK" to exit.
β Windows 10
- Press
Windows
button (keyboard) - Blazon
ENV
+ pressEnter
β΄
- Select
Environment Variables
β΄
- The post-obit should appear:
- Side by side, click
New
to add thebin
directory for the new red directory you created (likewise add the devkitbin
directory if you've installed that):
- Click
OK
and go out anyCMD
instances you take open up.
π¨ Build Tools π¨
Adjacent, y'all need to install "build tools".
These are used to compile gems that rely on external libraries
(nokogiri / rmagick / mysql2
):
β
*ALL* operating systems require build tools equally extra downloads. They are applications, files and libraries which assistance your system compile gems.
In Ubuntu, you'd install the build-essential
bundle:
In Windows, you need to download the tools separately.
How you exercise this is adamant past which version of RubyInstaller you choose. If you used 2.3.x
, you lot use Devkit; 2.iv.x
+ 2.v.ten
utilize MSYS2:
β
Devkit (β€ 2.3.x) (Good tutorial)
For older versions (up to 2.3.x
) of RubyInstaller, you lot need "DevKit" β΄
Ruby 2.4.10
did away with this, and then if yous're planning on using Ruby 2.4.10
or Ruby 2.5.x
, you'll be better using MSYS2 directly from their site.
β
Zip (β€ ii.3.x But β 2.iv.x/2.5.x NEEDS to apply MSYS2)β¦
After downloading 1 of the to a higher place files, load the self extracting archive and "unzip" to a temporary directory:
Once consummate, you need to initialize DevKit and bind it to your Ruby installation:
- Load up
cmd
andcd
into the RubyGems directory - Type the following:
ruby init.rb
& pressEnter
- Side by side, load up the
config.yml
β - Add the directory for your
Ruby
installation:
# devkit/config.yml
# ...
#
# Instance:
#
# ---
# - C:/ruby19trunk
# - C:/ruby192dev
#
---
- "C:/Program Files/Ruby200-x64"
- Next, in
cmd
you should blazonruby setup.rb
& printingEnter
- This should bind DevKit to your Reddish installation, allowing information technology to phone call all the libraries.
MSYS2 (STRONGLY Recommended β essential for β₯ 2.4x / 2.5.x)
Ruby 2.4.10
/ ii.5.x
(RubyInstaller2) uses MSYS2 β΄
Setting up MSYS2 is slightly more involved than DevKit, merely more effective.
The indicate is that both install a series of files or applications which allow
yous to perform build / compilation operations:
- Download the appropriate version of MSYS2
x86
orx64
:
- Save the installer to your difficult drive
- Double-click the installer to become information technology to load:
- Later on the installer completes, you need to ready
pacman
- Load a new
MSYS2
panel and type the following:
pacman -Sy pacman
Y'all should see something similar to the following:
Using the above commands, pacman
volition be installed and ready to use.
Now, you lot need to install the diverse build dependencies. This used to be
washed from within MSYS2 itself, merely now it's part of the RubyInstaller2 installation process:
- Open up up CMD
- Type
ridk install
- The following screen should appear:
Press 3 and Enter.
From here, it should piece of work to install the various components of the MSYS2 evolution toolchain. If this process fails (nosotros had a Windows 8 user where the process hung randomly), you'll want to switch back to MSYS2 and run one of the post-obit commands (installs the build tools manually):
pacman -S base-devel mingw-w64-i686-toolchain #32-fleck
pacman -S base of operations-devel mingw-w64-x86_64-toolchain #64-bit
If this does not work (in Windows 8), y'all should continually resize the MSYS2 window. This is what it took to get it working on a reader'south system.
β
Installing C-dependent Gems (Nokogiri / SQLite3 etc)
The RubyInstaller2 repo has a expert tutorial on how to practise this:
β οΈπ¨ NOTE Most SQLITE3 π¨β οΈ
If you apply SQLite3 (as nosotros do in development), you'll find the latest version of the gem to be incompatible with Windows.
The respond to this is to install the "mingw-w64-x86_64-dlfcn
" package through MSYS2:
This installs the correct parcel, allowing you to run the SQLite3 1.4.0 gem within the Windows environment.
π§Ά Yarn/WebPacker
If you desire to install Webpacker (which requires yarn
), you lot will need to install the packages which back up it. Whilst MSYS2 supports both yarn
& nodejs
, we're yet to find a way to brand them work on a base of operations/organization level (they install, merely are non attainable by Rails)β¦
pacman -S mingw-w64-x86_64-yarn
pacman -S mingw-w64-x86_64-nodejs
As mentioned, whilst these install, they don't piece of work with Track/Webpacker withal.
Instead, you lot will need to download and install the native packages from the Yarn & NodeJS websites:
π RubyGems π
Next, you need to install RubyGems.
RubyGems is the repository which stores all the "gems" you tin can install on Ruby. These gems are the "plugins" for the language, providing functionality.
β
Equally this is a divide package to Ruby, it has to be installed manually:
To install RubyGems, you lot need to download the Zip and
unzip to a temporary binder:
From there, you will need to open cmd.exe
and cd
into the TEMPORARY folder. Y'all should then blazon ruby setup.rb
and RubyGems willinstall:
If successful, you'll exist able to blazon gem -v
in a new example of cmd
:
π Rails π
With RubyGems installed, you need to install the rail
gem:
β οΈπ¨ NOTE ABOUT Ruby ii.7.0+ π¨β οΈ
The recent updates in Red 2.7.0 take caused several problems for Rails.
Specifically, the electric current "nokogiri" precious stone is not compatible with > Ruby two.7.0, so installing a "naked" version of Track kicks up an mistake:
Whilst Nokogiri have released a "pre" version of their precious stone (which addresses this problem), it doesn't install and Rails is still unable to install at the "system" level.
To get around this, you need to install Track with the help of the bundler.
The best way I have found (to fix it) is to make sure that Bundler is using the "global" gem repository, and so add the post-obit to your Gemfile:
Doing this with Runway in the same Gemfile gets it installed (with the current restrictions). No other style, apart from that, presently.
If yous're using a Red version pre ii.7.0, you should open cmd
and type:
gem install runway --no-document
- You also need
bundler
considering without information technology, you cannot use aGemfile
- You demand
rails
because that's the framework y'all're using.
Installing Rails as a system-wide jewel will give you the power to telephone call it whenever needed, non just as part of a Rail awarding:
π¦ GIT π¦
Yous then demand to install GIT.
Git is a source lawmaking management arrangement ( SCM ), basically allowing you to sync your evolution source with production and staging environments.
It has taken over the office of FTP, allowing you to "push" code to "repositories". If this sounds alien, you need to read up on it. It'southward an essential role of modern web evolution β especially Track. Github is a very good place to start:
The installation procedure should be performed equally follows:
One time installed, y'all should load a new instance of cmd.exe
and type the command git β version
. If it returns a value, the installation was a success:
π» IDE (Code Editor) π»
Finally, you need an IDE (Integrated Evolution Surround).
Whist y'all're free to use Notepad to edit lawmaking, the best organization is to apply a dedicated code editor. The former favorite was Sublime Text, however it was
not updated enough and price.
We employ Atom.io from GitHub (free & open source):
You lot can download hither (free).
π After this, y'all're able to develop Ruby on Rails on Windows! π
π₯ Thanks For Reading! π₯
If you demand further assistance, please experience costless to enquire belowβ¦
Source: https://medium.com/ruby-on-rails-web-application-development/how-to-install-rubyonrails-on-windows-7-8-10-complete-tutorial-2017-fc95720ee059
Posted by: scottancend.blogspot.com
0 Response to "How To Install Ruby On Windows 8"
Post a Comment