Bird
0
0

You try to run a Ruby script with ruby myscript.rb but get an error: ruby: command not found. What is the most likely cause?

medium📝 Debug Q14 of 15
Ruby - Basics and Runtime
You try to run a Ruby script with ruby myscript.rb but get an error: ruby: command not found. What is the most likely cause?
AThe script file <code>myscript.rb</code> has a syntax error.
BRuby is not installed or not in your system's PATH.
CYou forgot to save the script file.
DYou need to add <code>./</code> before the filename.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the error message

    The error ruby: command not found means the terminal cannot find the ruby program.
  2. Step 2: Identify the cause

    This usually means Ruby is not installed or its location is not in the system PATH environment variable.
  3. Final Answer:

    Ruby is not installed or not in your system's PATH. -> Option B
  4. Quick Check:

    Command not found means Ruby missing or PATH issue [OK]
Quick Trick: Command not found means Ruby missing or PATH issue [OK]
Common Mistakes:
MISTAKES
  • Assuming syntax error causes command not found
  • Thinking file must be saved to fix this error
  • Adding ./ before filename only works for executables, not ruby command

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes