1) Is it possible to install Ruby (the compiler) onto a flashdrive and run it on another machine without adding the registry edits? Is there like a portable copy of the compiler that I can use? I need Ruby at school, but I can't install anything.


2) I think my Ruby is dead. I try to run a really simple program and Ruby hangs whenever I use gets()... For example:

name = gets("What is your name? ")
puts name

Inputted in SciTE makes the command line for Ruby pop up, then it freezes, only to let me exit Ruby and continue working. I can use puts() and other commands fine. What is wrong:?: I NEED RUBY TO WORK!

Dani AI

Generated

Brief practical follow‑up to the thread (and to the helpful hints from , and ) with solutions that survive changing drive letters and avoid editor-related stdin problems.

A robust portable‑Ruby approach for Windows
Place a Ruby folder (for example from the RubyInstaller 7z archive) on the USB stick and use a tiny launcher that sets paths relative to the stick’s drive letter. The wrapper below switches to the batch file’s drive, adds Ruby’s bin to PATH for the session, and either starts IRB or runs a script you pass to it:

@echo off
rem portable-ruby-runner.bat  — put this in the USB root next to a "ruby" folder
setlocal
set "RUBY_HOME=%~d0%\ruby"
set "PATH=%RUBY_HOME%\bin;%PATH%"
cd /d "%~dp0"
if "%1"=="" (
  "%RUBY_HOME%\bin\irb.bat"
) else (
  "%RUBY_HOME%\bin\ruby.exe" "%~1" %2 %3 %4
)
endlocal

This uses the batch parameter expansion that returns the script’s drive/path so the launcher works regardless of which letter Windows assigns. RubyInstaller FAQ (github.com)

Avoiding the editor stdin hang
Some editors run programs inside an output pane where stdin isn’t handled the way a normal console is, which makes interactive gets‑style input appear to “hang.” For interactive testing, run scripts from a real command prompt or configure the editor to spawn an external console. If you must run inside the editor, try forcing streams to flush (for example using STDOUT.flush or $stdin.sync = true) — many community threads and Q&A note this as the practical workaround. (stackoverflow.com)

If you plan to distribute apps rather than just carry an interpreter, consider self‑contained binaries (e.g., Traveling Ruby) or bundling the extracted runtime so users don’t need installs or elevated rights. (phusion.github.io)

Recommended Answers

All 5 Replies

Hmm... I got both of them fixed, with a little work. I copied the whole directory for Ruby onto my flashdrive, and it works! And for the other, it was SciTE that was hanging it.

Hmm... I got both of them fixed, with a little work. I copied the whole directory for Ruby onto my flashdrive, and it works! And for the other, it was SciTE that was hanging it.

Afraid I never tried to run Scite from a flash drive. Have you tried Notepad++? When I was at uni I ran that from my flash cos the text editor installed on the Windows workstations was annoying (so bad that most people just used notepad).

I copied the whole directory for Ruby onto my flashdrive, and it works!

So flash drives don't make registry references?

I think it is SciTE's output windows that hangs the input.

The Geany IDE works very well with Ruby.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.