I've been trying to install ruby dev kit and following the instruction on this page.
http://rubyonwindowsguides.github.io/book/ch02-04.html
My problem is that when I run rb.dk in the devkit directory, it quits before i am able to do anything (so i am not able to follow next steps).
I really appreciate all help.
run it in a cmd prompt as C:\Ruby\devkit>ruby dk.rb.
Running it by associating the CLI with the file causes the cmd prompt to close as soon as the ruby interpreter stops.
Related
I did a fresh install of Ruby 2.6.5 x86 on my Windows Server 2016 64-bit machine (previously had 64-bit 2.6.5 and some 2.4.5 version. Can't remember if it was 32/64 bit). I did NOT run the MSYS install at the end. I see the PATH has been updated to include ruby. When I type ruby in a command prompt nothing happens. I do not get a message saying ruby is unrecognized. It actually looks like ruby is going to open (I see mouse loading animation) in the command prompt but then immediately terminates. How do I fix this?
As requested here are the results of where ruby:
ruby
is not interactive interpreter, it is only used to run complete scripts like this:
ruby script.rb
Use
irb
for interactive programming. You also can run a script and then poke around inside it with
irb -r ./script.rb
After installing the gem pry, and typing pry in terminal, i get an error saying that the command is not found:
Successfully installed pry-0.12.2
Parsing documentation for pry-0.12.2
Done installing documentation for pry after 1 seconds
1 gem installed
-bash: pry: command not found
So much depends on the details of your ruby installation that its difficult to give you a recipe to follow that will work from this point, but the general answer to why you can't execute pry is that the pry binary is not in your PATH. If you find the place where your gem binaries live and add that to your PATH, then you will be able to execute pry. Exactly how to do that depends on how you've installed Ruby and how your environment is set up. For example, if you use rbenv, and want to use a binary immediately after installing it, then I know that you have to run rbenv rehash. But there may be other procedures to follow for other setups.
Maybe a simpler way for you to initiate a pry session is to execute irb instead, and from there you can require 'pry' and Pry.start
Be sure that you add pry to your Environment Variables (windows)
Write env in the start menu then pick Edit the System Environment Variables then go to tab Advanced then click on Environment Variables
In User Variables Select the Path then click Edit then New and past your ruby path for example C:\Ruby26-x64\bin (this directory if you go inside it you will see the pry there)
And Click ok then ok then ok.
Now close your terminal and open it again (the problem should be solved after that) [try to restart your PC if it didn't solve, then open the terminal and try again]
I came across the same issue. It got resolved simply after I restarted my terminal (I use iTerm2 on Mac).
First off, I have read through previous questions and answers and have not found anything that solves my issue.
On the official Pry website, http://pryrepl.org/, it says that this will install pry for you: "gem install pry" however, I've tried doing that and get this error "ERROR: While executing gem ... (Zlib::DataError) invalid code lengths set"
Looking into more answers on how to install this, I've found suggesting to type in "gem install pry-windows", still no results.
Can someone take a step back to before typing that code and let me know what requirements are needed beforehand?
I have ruby installed and I generally use cmd to run my ruby files. I also have irb (Interactive Ruby) and have tried running the above commands there, also to no avail.
Where am I supposed to be running these commands "gem install pry", cmd or irb? Also, do I need to download any files beforehand?
After lots of digging around, I just figured it out.
I had to install RubyGems first. http://rubygems.org/pages/download When doing this for windows, follow the regular instructions, but then when you run "ruby setup.rb" make sure that you opened the command line using "Run as Administrator".
Hope this helps anyone else figuring out how to download Pry.
I would like to install ruby from the command line. I don't mind where it gets installed from but I guess Here would probably be the best place.
The aim is to use ocra to provide a one click installer that runs a ruby script through the command line. Using the backsticks `` arguments method in ruby to install a list of gems along with it. This way, should I decide to change computer, I can run the ruby install as a .exe file and it will do it all for me.
Will this method work? What do you think? What would the command be to actually download and run the rubyinstaller" from the command line?
I am running windows XP.
For automatically pulling down from the web, you can try wget for windows. Then you can point it at the installer url.
Edit: (thanks to excellent suggestion by Ninjaxor)
You can then invoke installer via either the /silent or /verysilent command line options.
I can't get the Ruby interpreter to run on either of my Macs (one MacBook and one MacBook Pro, both running Snow Leopard). When I run it, by typing ruby in Terminal, nothing happens. It just sits there. I can kill it by pressing Ctrl+C, but that's it. I know the Ruby process is running, since I can see it in Activity Monitor, and running ruby --version works fine.
I have tried the following, all to no avail:
I have some bash customizations, so I tried disabling them, but that didn't help.
I installed a new copy of Ruby 1.8.7 using MacPorts, but that one had the same problem.
I tried quitting and restarting the Terminal application.
Some other information that might be useful:
I'm trying to run the version of Ruby that comes with Snow Leopard.
I have installed Apple's developer tools.
Other interpreters (Python, Io, etc.) work fine.
I spent a while tonight searching for this problem online, but haven't found any discussion of it. I'm at a loss for what could be causing it, so any help anybody can provide would be greatly appreciated.
Ruby command itself will just behave the way you said, either provide it with script file or use the -e option:
ruby -e ' puts "hello world" '
However I suspect that you want the IRB(interactive ruby). Run irb in your shell.
What are you trying to do, exactly? The ruby command expects input, in most cases a file that contains Ruby code that you want it to run. In that case you have to specify the name of the file:
> ruby my_ruby_file.rb
If instead you want to run the interactive Ruby shell, i.e. the REPL console that you can type Ruby code into and have it executed each time you press enter, the command you want is irb.