I'm new to ruby. I tried to install Ruby Gems on my PC by following the steps given in the site http://rubygems.org/pages/download.
I downloaded the package from the mentioned site, changed the directory to the directory in which the setup resides, and tried to run setup using the command setup.rb in command prompt.
But I get a window pop up that says "Windows can't open this file" and prompts me to select a program to open this file.
What should I do now? Let me know if I am doing something wrong.
To setup you Ruby development environment on Windows:
Install Ruby via RubyInstaller: http://rubyinstaller.org/downloads/
Check your ruby version: Start - Run - type in cmd to open a windows console
Type in ruby -v
You will get something like that: ruby 2.0.0p353 (2013-11-22) [i386-mingw32]
For Ruby 2.4 or later, run the extra installation at the end to install the DevelopmentKit. If you forgot to do that, run ridk install in your windows console to install it.
For earlier versions:
Download and install DevelopmentKit from the same download page as Ruby Installer. Choose an ?exe file corresponding to your environment (32 bits or 64 bits and working with your version of Ruby).
Follow the installation instructions for DevelopmentKit described at: https://github.com/oneclick/rubyinstaller/wiki/Development-Kit#installation-instructions. Adapt it for Windows.
After installing DevelopmentKit you can install all needed gems by just running from the command prompt (windows console or terminal): gem install {gem name}. For example, to install rails, just run gem install rails.
I recommend you just use rubyinstaller
It is recommended by the official Ruby page - see https://www.ruby-lang.org/en/downloads/
Ways of Installing Ruby
We have several tools on each major platform to install Ruby:
On Linux/UNIX, you can use the package management system of your
distribution or third-party tools (rbenv and RVM).
On OS X machines, you can use third-party tools (rbenv and RVM).
On Windows machines, you can use RubyInstaller.
Use chocolatey in PowerShell
choco install ruby -y
refreshenv
gem install bundler
Installing Ruby
Go to http://rubyinstaller.org/downloads/
Make sure that you check "Add ruby ... to your PATH".
Now you can use "ruby" in your "cmd".
If you installed ruby 1.9.3 I expect that the ruby is downloaded in C:\Ruby193.
Installing Gem
install Development Kit in rubyinstaller.
Make new folder such as C:\RubyDevKit and unzip.
Go to the devkit directory and type ruby dk.rb init to generate config.yml.
If you installed devkit for 1.9.3, I expect that the config.yml will be written as C:\Ruby193.
If not, please correct path to your ruby folders.
After reviewing the config.yml, you can finally type ruby dk.rb install.
Now you can use "gem" in your "cmd". It's done!
Another way is to let chocolatey manage your ruby package (and any other package), that way you won't have to put ruby in your path manually:
Install chocolatey first by opening your favourite command prompt and executing:
#powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin
then all you need to do is type
cinst ruby
In your command prompt and the package installs.
Using a package manager provides overall more control, I'd recommend this for every package that can be installed via chocolatey.
I use scoop as command-liner installer for Windows... scoop rocks!
The quick answer (use PowerShell):
PS C:\Users\myuser> scoop install ruby
Longer answer:
Just searching for ruby:
PS C:\Users\myuser> scoop search ruby
'main' bucket:
jruby (9.2.7.0)
ruby (2.6.3-1)
'versions' bucket:
ruby19 (1.9.3-p551)
ruby24 (2.4.6-1)
ruby25 (2.5.5-1)
Check the installation info :
PS C:\Users\myuser> scoop info ruby
Name: ruby
Version: 2.6.3-1
Website: https://rubyinstaller.org
Manifest:
C:\Users\myuser\scoop\buckets\main\bucket\ruby.json
Installed: No
Environment: (simulated)
GEM_HOME=C:\Users\myuser\scoop\apps\ruby\current\gems
GEM_PATH=C:\Users\myuser\scoop\apps\ruby\current\gems
PATH=%PATH%;C:\Users\myuser\scoop\apps\ruby\current\bin
PATH=%PATH%;C:\Users\myuser\scoop\apps\ruby\current\gems\bin
Output from installation:
PS C:\Users\myuser> scoop install ruby
Updating Scoop...
Updating 'extras' bucket...
Installing 'ruby' (2.6.3-1) [64bit]
rubyinstaller-2.6.3-1-x64.7z (10.3 MB) [============================= ... ===========] 100%
Checking hash of rubyinstaller-2.6.3-1-x64.7z ... ok.
Extracting rubyinstaller-2.6.3-1-x64.7z ... done.
Linking ~\scoop\apps\ruby\current => ~\scoop\apps\ruby\2.6.3-1
Persisting gems
Running post-install script...
Fetching rake-12.3.3.gem
Successfully installed rake-12.3.3
Parsing documentation for rake-12.3.3
Installing ri documentation for rake-12.3.3
Done installing documentation for rake after 1 seconds
1 gem installed
'ruby' (2.6.3-1) was installed successfully!
Notes
-----
Install MSYS2 via 'scoop install msys2' and then run 'ridk install' to install the toolchain!
'ruby' suggests installing 'msys2'.
PS C:\Users\myuser>
Check that ruby interpreter is already installed and try "ruby setup.rb" in command prompt.
You can use official MS WinGet to install Ruby from command line:
winget install RubyInstallerTeam.Ruby.3.1
or
winget install -e --id RubyInstallerTeam.RubyWithDevKit.3.1
It would install to C:\Ruby31-x64 by default.
Related
I'm trying to install rubygems on my windows7 pc. I've download the rubygems-2.4.1.zip from https://rubygems.org/pages/download. Now I'm trying to install rubygems through the command:
ruby setup.rb
But I see the error:
'ruby' is not recognized as an internal or external command
How can I use 'ruby' command on my pc?
Downloaded rubygems-2.4.1.zip does not contain any exe file, through which I can install it. I'm a beginner. Please help me.
Try RubyInstaller on Win32 Platforms
Rubygems is a package manager for Ruby, which is a per-requisite that you may or may not have properly installed on your OS. Installing Ruby on Windows properly is tricky; your best bet is to use RubyInstaller to install Ruby and Rubygems, and make sure to read the RubyInstaller FAQ.
Good luck!
My ultimate goal is to install Sass.
To do this I need to install RubyGems
To do this I need to install Ruby.
I installed Ruby with yum.
I then tried to install gem with yum yum install rubygem
The response is "nothing to do" and yet when I write gem install sass I get:
gem: command not found
I decided to try to install rubygems 2.2.2 manually. After downloading it, I tried to run ruby setup.rb and in response I get:
Rubygems now requires Ruby 1.8.7 or later
But yum does not seem to be able to install anything later than 1.8.5.
So now I'm trying to do this manually.
I downloaded Ruby 1.9.2 to my home directory and followed these instructions: http://howboring.com/post/1226760251/centos-5-and-rails-3-and-ruby-1-9-2
This seems to work, but the problem is ruby1.9.2 is installed in my home directory (i.e. ~/ruby1.9.3 not system wide.
Thus in the directory where I installed ruby 1.9.2 ruby -v still gives 1.8.5 but ./ruby -v returns 1.9.2. And which ruby returns /usr/bin/ruby (I suppose I could replace this with a symlink that points to ~/ruby1.9.2/ruby but this doesn't seem like a "best practice")
So my main question is where should install ruby 1.9.2 with Root Permissions so that 1.8.5 is replaced with 1.9.2 system wide.
My corollary question is: is there any easier way to do this? (perhaps install sass without install rubygems??)
I then tried to install gem with yum yum install rubygem
You have a typo in the package name, it is actually named rubygems.
Can i suggest Wayne Seguins excellent rvm (ruby version manager). As the home page states:
"RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems".
Site has comprehensive installation instructions. I've posted a truncated Set of instructions for installing on POSIX systems below, but please refer to the projects' home page as:
"we have spent massive amounts of man hours debugging the installation process. Please use the install process(es) from this site only, as this is the only supported installation types and methods."
Install RVM (development version):
\curl -sSL https://get.rvm.io | bash
Close out your current shell or terminal session and open a new one (preferred). You may load RVM with the following command:
user$ source ~/.rvm/scripts/rvm
test the installation was successful:
user$ type rvm | head -n 1
this should output "rvm is a function"
List all known rubies:
rvm list known //this will output a large list of rubies shortened here
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-p374]
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p320]
[ruby-]1.9.3[-p545]
[ruby-]2.0.0-p353
[ruby-]2.0.0[-p451]
[ruby-]2.1[.1]
[ruby-]2.1-head
ruby-head
...
install the version you want:
rvm install 1.9.2
You can set a version of Ruby to use as the default for new shells. Note that this overrides the 'system' ruby:
rvm use 2.1 --default
You can also temporarily use another version of your ruby versions
rvm list known //lists system available rubies
Choose to use another ruby
rvm use 1.9.3
RVM is a great tool, well documented, and actively developed, it handles a wider scope of functionality than i can list here, and it's a tool I use everyday.
You can use rbenv to install ruby and rubygems that you need
https://gist.github.com/jpfuentes2/2002954
Sorry to ask such a basic question. I'm trying to install tiny_tds as explain on this page. I've tried $ gem install tiny_tds, I'm getting error: Syntaxt error, unexpected $undefined. If I remove $, the error becomes undefined local variable or methos "tiny_tds". I don't know where to start to install a gem. I'm using the ruby command prompt.
Thanks for helping
I guess you should try railsinstaller for windows that includes rubygems. Then gem install tiny_tds in the command prompt.
You need to download the Ruby installer depending on you systems settings (32 or 64 bit) and the ruby development kit in order to run command lines. Here is a link to the installer and a simple guide for installing the DevKit for ruby on windows (this one is to make jekyll run on windows, jekyll is other ruby gem):
Ruby Installer:
http://rubyinstaller.org/downloads/
Devkit configuration:
http://www.madhur.co.in/blog/2011/09/01/runningjekyllwindows.html
I have copy the make.bat to bin\ folder,when run the command gem install bcrypt-ruby,
it shows the bash.exe is not the internal or external command.
How to solve it?
I was trying to install "bcrypt-ruby" on Windows 8, 64 bit .
Tried a lot of configurations, ranging from different versions of the gem, direct from git, platform ruby etc.
But nothing worked
At the end installed DEVKIT compatible to my ruby version and thats it.
Steps
Install Devkit compatible to your ruby version
Link : http://rubyinstaller.org/downloads/
Download under
C:/Ruby Folder/devkit
Then on command line go to above path
C:/Ruby Folder/devkit
then say
gem install bcrypt-ruby
This should install it,
Post this, you need to add the gem to your Gemfile and say
bundle install
bundle update
bundle install
This should work fine. Also solves update issues related to active_record etc.
The same should work for WIN 64, WIN 32 also.
Simple question: How to install FxRuby on windows.
I have installed ruby 1.9 using one click installer from http://rubyinstaller.org/
Just open up command prompt and type:
gem install fxruby
It will then be installed and ready to use. To use it in your applications, just place:
require 'fox16'
at the top of your file.
In 1.9.2 it is included in Windows package so no gem download needed.
It does not appear in the gem list though, buts it's there.
As of 1.6.20, installation can be performed using gem install fxruby:
Release notes for 1.6.20