All Ruby commands immediately close - ruby

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

Related

Running Ruby Script

Can someone help me out?
So I installed Ruby 2.4 on my PC via the RubyInstaller from https://rubyinstaller.org/downloads/. I have Windows 10.
I've used Ruby 2.2 and this 2.4 version seems very different.
When I installed it, it created an MSYS2.exe and it now opens a bash shell.
I've not used a bash shell in a very long time (14+ years). I can navigate fine in it. But I receive the following error message when I try to run a ruby file:
$ ruby r1.rb
bash: ruby: command not found
I'm not sure how to run a ruby script on the bash shell from MSYS. I have added the C:\Ruby24-x64\bin to my environment variables. But I still get the same message.
I'd appreciate some assistance if possible. Thanks.

Ruby devkit installing issue

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.

How do i install Command-T, Pathogen, and not using RVM?

I used brew install to install ruby (as opposed to RVM). I have on my system installed ruby 1.9.3p0. (OSX Lion)
I'm trying to install Command-T via pathogen. I can normally run rake, make, ruby, whatever, but when i enter into the 'Command-T' directory and try to run rake make it says Could not find rake-0.8.7 in any of the sources.
I also cant run any normal ruby command. just ruby --version produces the same errors.
I know this has to do with below... but i dont know how to actually fix it.
Most installation problems are caused by a mismatch between the
version of Ruby on the host operating system, and the version of Ruby
that Vim itself linked against at compile time. For example, if one is
32-bit and the other is 64-bit, or one is from the Ruby 1.9 series and
the other is from the 1.8 series, then the plug-in is not likely to
work.
As such, on Mac OS X, I recommend using the standard Ruby that comes
with the system (currently 1.8.7) along with the latest version of
MacVim (currently version 7.3). If you wish to use custom builds of
Ruby or of MacVim (not recommmended) then you will have to take extra
care to ensure that the exact same Ruby environment is in effect when
building Ruby, Vim and the Command-T extension.
I tried temporarily moving the entire Cellar directory out of /usr/local (for those arent familiar, its where homebrew installs ruby and everything else).
In terminal if i run which ruby it works right.. yet when i rune rake make in the Command-T folder it still gives the same error
nevermind... all i had to do was run /usr/bin/rake make
how thats different than just removing the Cellar folder temporarily so that by default shell uses that path, i have no idea, but it worked.
I had similar problem on Fedora.
In the end, I found we should install rubygem-rake and ruby-dev package first.
After installing both, compile your Vim with "./configure --enable-rubyinterp",
then Commend-T will be ok.

How to get Pik running in Git/Cygwin after it gets running in Command prompt of Windows XP?

I have Installed Ruby 1.8.7. Now I want to have Ruby 1.9.2 as well on my system.Having a windows system I have to go for PIK instead of RVm. I have already in place Cygwin and Git Bash. I now have installed pik through windows XP command prompt and changed the $PATH variable putting the pik path before ruby path. Now pik commands work sin windows but do not allow me to install new Ruby as throws anerror "1.9.2 is unknown". My Cygwin and Git gets the ruby version right but do not recognize pik common and I am not sure how to get it done. From other article i changed the the USER PROFILE variable in one of the bash files of Cygwin and also Git and tried but to no help.
I need your help in telling me exactly which file i need to put that common and in $USERPROFILE directory i could not locate any bash file and all my installation are on C drive.

The command "ruby" does nothing on my Mac

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.

Resources