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!
Related
I use github+jekyll to build blog, i try to install jekyll to local(windows 10), while it failed when i rungem install jekyll and the stack trace is
C:\Developments\FrontEnd\rubygems-2.7.7>gem install jekyll
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: C:/Developments/FrontEnd/Ruby25-x64/lib/ruby/gems/2.5.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
C:/Developments/FrontEnd/Ruby25-x64/bin/ruby.exe -r ./siteconf20180806-33956-l8y76h.rb extconf.rb
creating Makefile
current directory: C:/Developments/FrontEnd/Ruby25-x64/lib/ruby/gems/2.5.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make "DESTDIR=" clean
'make' is not recognized as an internal or external command,
operable program or batch file.
current directory: C:/Developments/FrontEnd/Ruby25-x64/lib/ruby/gems/2.5.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make "DESTDIR="
'make' is not recognized as an internal or external command,
operable program or batch file.
make failed, exit code 1
what i do is:
1. install ruby, path variable was set, version: ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32].
2. install rubygems, version: 2.7.7.
3. install MSYS2.
4. install jekyll, gem install jekyll, then the above error occurs and i'm not sure the reason.
i have tried to install devkit and it not works, i think my ruby version is 2.5+, so don't need devkit and i have uninstalled it.
Anyone could help me?
Although they made the Ruby+DevKit an "optional" download for the RubyInstaller on Windows, if you plan to install gems, it is practically a necessity. A large percentage of the most popular gems are C extension that will need built on your machine when being installed.
The DevKit is a handy toolchain that supplies everything you need for this to be done, automatically without you needed to do anything more than type gem install XXXXX. Without it, you either cannot use C extension gems, or must have already installed MSYS and MingW, have them configured properly, which is all not a user-friendly experience, even for those who familiar with the process.
So even if DevKit is optional, it is still required to make the most of Ruby on Windows.
Solution re-install ruby with rubyinstaller-devkit-2.5.5-1-x64
and issue
gem install bundler
gem install jekyll
I got the same error message. It turned out that the culprit was the ffi gem. I got it to work using this solution.
I had the same issue. I was able to resolve it (in Windows 11 x64) via:
winget install -e --id RubyInstallerTeam.RubyWithDevKit
(I.e., reinstall Ruby with the DevKit)
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.
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
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
I'm having problems getting thin working on my Windows 7 machine (I've already installed eventmachine v0.8.1):
>gem install thin --ignore-dependencies
checking for main() in -lc... no
creating Makefile
make
'make' is not recognized as an internal or external command, operable program or batch file.
Are there not meant to be precompiled binaries available for thin?
Apparently, there aren't any pre-built binaries.
You will need a C compiler installed. If you installed Ruby via the RubyInstaller, that is going to be really easy, if you used the One-Click Installer, it's goint to be a PITA.
See also: problems installing thin on Windows, which contains an answer by the RubyInstaller and One-Click Installer maintainer.
There actually are pre-built binaries for particular versions of Thin but you need to know which ones. To get the latest pre-built win32 version do the following:
Go to the RubyGems Thin page
Look under the "Versions" section for a version that has "x86-mswin32" to the right of it. (As of today versions 1.2.11, 1.2.10, etc all have win32 binaries)
Run the following following "gem install" command with the version of Thin included with the "-v" flag:
gem install thin -v 1.2.11
Here are the results from my installation:
c:\>gem install thin -v 1.2.11
Successfully installed thin-1.2.11-x86-mswin32
1 gem installed
Installing ri documentation for thin-1.2.11-x86-mswin32...
Updating ri class cache with 3611 classes...
Installing RDoc documentation for thin-1.2.11-x86-mswin32...
I've worked around the lack of precompiled binaries by installing a compiler:
I iInstalled MinGW to C:\MinGW (see here for installation instructions)
I then installed MSYS to C:\msys\1.0
I then added c:\MinGW\bin and C:\msys\1.0\bin to my %PATH%
Finally I ran gem install thin and amazingly it all worked!
I hope this helps out some other poor Windows ruby developer! :-)
A binary for thin is in fact available (and apparently one has been since ver 1.2.2).
However, I couldn't install thin on Windows 7 with Ruby 1.9.2 (p290) because of its dependency on EventMachine.
Running gem install thin --ignore-dependencies was what was needed to get thin itself installed.
Just wanted to add this note for some other ruby on Windows user.