OS Manuals

/usr/bin/ruby

the Ruby programming language

From ruby-4.0 4.0.9-r1 (os), captured 2026-11-05 by running ruby --help (exit 0). permalink

Also provided by 27 other package versions
Usage: /usr/bin/ruby [options] [--] [filepath] [arguments]
  -0[octal]       Set input record separator ($/):
                  -0 for \0; -00 for paragraph mode; -0777 for slurp mode.
  -a              Split each input line ($_) into fields ($F).
  -c              Check syntax (no execution).
  -Cdirpath       Execute program in specified directory.
  -d, --debug     Set debugging flag ($DEBUG) and $VERBOSE to true.
  -e 'code'       Execute given Ruby code; multiple -e allowed.
  -Eex[:in], --encoding=ex[:in]
                  Set default external and internal encodings.
  -Fpattern       Set input field separator ($;); used with -a.
  -i[extension]   Set ARGF in-place mode;
                  create backup files with given extension.
  -Idirpath       Prepend specified directory to load paths ($LOAD_PATH);
                  relative paths are expanded; multiple -I are allowed.
  -l              Set output record separator ($\) to $/;
                  used for line-oriented output.
  -n              Run program in gets loop.
  -p              Like -n, with printing added.
  -rlibrary       Require the given library.
  -s              Define global variables using switches following program path.
  -S              Search directories found in the PATH environment variable.
  -v              Print version; set $VERBOSE to true.
  -w              Synonym for -W1.
  -W[level=2|:category]
                  Set warning flag ($-W):
                  0 for silent; 1 for moderate; 2 for verbose.
  -x[dirpath]     Execute Ruby code starting from a #!ruby line.
  --jit           Enable the default JIT for the build; same as --yjit.
  --yjit          Enable in-process JIT compiler.
  --zjit          Enable method-based JIT compiler.
  --backtrace-limit=num
                  Set backtrace limit.
  --copyright     Print Ruby copyright.
  --crash-report=template
                  Set template for crash report file.
  --disable=features
                  Disable features; see list below.
  --dump=items    Dump items; see list below.
  --enable=features
                  Enable features; see list below.
  --external-encoding=encoding
                  Set default external encoding.
  --help          Print long help message; use -h for short message.
  --internal-encoding=encoding
                  Set default internal encoding.
  --parser=parser Set Ruby parser: parse.y or prism.
  --verbose       Set $VERBOSE to true; ignore input from $stdin.
  --version       Print Ruby version.
  -y, --yydebug   Print parser log; backward compatibility not guaranteed.
Dump List:
  insns           Instruction sequences.
  yydebug         yydebug of yacc parser generator.
  parsetree       Abstract syntax tree (AST).
  -optimize       Disable optimization (affects insns).
  +error-tolerant Error-tolerant parsing (affects yydebug, parsetree).
  +comment        Add comments to AST (affects parsetree with --parser=parse.y).
Features:
  gems            Rubygems (only for debugging, default: enabled).
  error_highlight error_highlight (default: enabled).
  did_you_mean    did_you_mean (default: enabled).
  syntax_suggest  syntax_suggest (default: enabled).
  rubyopt         RUBYOPT environment variable (default: enabled).
  frozen-string-literal
                  Freeze all string literals (default: disabled).
  yjit            In-process JIT compiler (default: disabled).
  zjit            Method-based JIT compiler (default: disabled).
Warning categories:
  deprecated      Deprecated features.
  experimental    Experimental features.
  performance     Performance issues.
  strict_unused_block
                  Warning unused block strictly
YJIT options:
  --yjit-mem-size=num
                  Soft limit on YJIT memory usage in MiB (default: 128).
  --yjit-exec-mem-size=num
                  Hard limit on executable memory block in MiB.
  --yjit-call-threshold=num
                  Number of calls to trigger JIT.
  --yjit-cold-threshold=num
                  Global calls after which ISEQs not compiled (default: 200K).
  --yjit-stats    Enable collecting YJIT statistics.
  --yjit-log[=file|dir]
                  Enable logging of YJIT's compilation activity.
  --yjit-disable  Disable YJIT for lazily enabling it with RubyVM::YJIT.enable.
  --yjit-code-gc  Run code GC when the code size reaches the limit.
  --yjit-perf     Enable frame pointers and perf profiling.
  --yjit-trace-exits
                  Record Ruby source location when exiting from generated code.
  --yjit-trace-exits-sample-rate=num
                  Trace exit locations only every Nth occurrence.
ZJIT options:
  --zjit-mem-size=num
                  Max amount of memory that ZJIT can use in MiB (default: 128).
  --zjit-call-threshold=num
                  Number of calls to trigger JIT (default: 30).
  --zjit-num-profiles=num
                  Number of profiled calls before JIT (default: 5).
  --zjit-stats-quiet
                  Collect ZJIT stats and suppress output.
  --zjit-stats[=file]
                  Collect ZJIT stats (=file to write to a file).
  --zjit-disable  Disable ZJIT for lazily enabling it with RubyVM::ZJIT.enable.
  --zjit-perf     Dump ISEQ symbols into /tmp/perf-{}.map for Linux perf.
  --zjit-log-compiled-iseqs=path
                  Log compiled ISEQs to the file. The file will be truncated.
  --zjit-trace-exits[=counter]
                  Record source on side-exit. `Counter` picks specific counter.
  --zjit-trace-exits-sample-rate=num
                  Frequency at which to record side exits. Must be `usize`.
Options (73)
OptionDescriptionSource
-0 octal(The digit zero''.) Specifies the input record separator ("$/") as an octal number.help + man
-aTurns on auto-split mode when used with -n or -p.help + man
-cCauses Ruby to check the syntax of the script and exit without executing.help + man
-CdirpathExecute program in specified directory.help
-d, --debugSet debugging flag ($DEBUG) and $VERBOSE to true.help + man + man
-e 'code'Specifies script from command-line while telling Ruby not to search the rest of the arguments for a script file name.help + man
-Eex, --encoding :inSet default external and internal encodings.help
-FpatternSet input field separator ($;);help
-i extensionSpecifies in-place-edit mode.help + man
-IdirpathPrepend specified directory to load paths ($LOAD_PATH);help
-l(The lowercase letter ell''.) Enables automatic line-ending processing, which means to firstly set "$" to the value of "$/", and secondly chops every line read using chomp!.help + man
-nCauses Ruby to assume the following loop around your script, which makes it iterate over file name arguments somewhat like sed -n or awk.help + man
-pActs mostly same as -n switch, but print the value of variable "$_" at the each end of the loop.help + man
-rlibraryRequire the given library.help
-sEnables some switch parsing for switches after script name but before any file name arguments (or before a --).help + man
-SMakes Ruby use the PATH environment variable to search for script, unless its name begins with a slash.help + man
-vEnables verbose mode.help + man
-wEnables verbose mode without printing version message at the beginning.help + man
-W level=2|:categorySet warning flag ($-W): 0 for silent;help
-x dirpathExecute Ruby code starting from a #!ruby line.help
--jitEnable the default JIT for the build;help
--yjitEnable in-process JIT compiler.help
--zjitEnable method-based JIT compiler.help
--backtrace-limit numLimits the maximum length of backtraces to num lines (default -1, meaning no limit).help + man
--copyrightPrints the copyright notice, and quits immediately without running any script.help + man
--crash-report templateSets the template of path name to save crash report.help + man
--disable featuresDisable features;help
--dump itemsDump some information.help + man
--enable featuresEnable features;help
--external-encoding encodingSet default external encoding.help + man
--helpPrints a summary of the options.help + man
--internal-encoding encodingSpecify the default external or internal character encodinghelp + man
--verboseEnables verbose mode without printing version message at the beginning.help + man
--versionPrints the version of the Ruby interpreter, and quits immediately without running any script.help + man
-y, --yydebugThis option is not guaranteed to be compatible.help + man + man
-optimizeDisable various optimizations to print a list disassembled bytecode instructions.help + man
--yjit-mem-size numSoft limit on YJIT memory usage in MiB (default: 128).help
--yjit-exec-mem-size numHard limit on executable memory block in MiB.help
--yjit-call-threshold numNumber of calls to trigger JIT.help
--yjit-cold-threshold numGlobal calls after which ISEQs not compiled (default: 200K).help
--yjit-statsEnable collecting YJIT statistics.help
--yjit-log file|dirEnable logging of YJIT's compilation activity.help
--yjit-disableDisable YJIT for lazily enabling it with RubyVM::YJIT.enable.help
--yjit-code-gcRun code GC when the code size reaches the limit.help
--yjit-perfEnable frame pointers and perf profiling.help
--yjit-trace-exitsRecord Ruby source location when exiting from generated code.help
--yjit-trace-exits-sample-rate numTrace exit locations only every Nth occurrence.help
--zjit-mem-size numMax amount of memory that ZJIT can use in MiB (default: 128).help
--zjit-call-threshold numNumber of calls to trigger JIT (default: 30).help
--zjit-num-profiles numNumber of profiled calls before JIT (default: 5).help
--zjit-stats-quietCollect ZJIT stats and suppress output.help
--zjit-stats fileCollect ZJIT stats (=file to write to a file).help
--zjit-disableDisable ZJIT for lazily enabling it with RubyVM::ZJIT.enable.help
--zjit-perfDump ISEQ symbols into /tmp/perf-{}.map for Linux perf.help
--zjit-log-compiled-iseqs pathLog compiled ISEQs to the file.help
--zjit-trace-exits counterRecord source on side-exit.help
--zjit-trace-exits-sample-rate numFrequency at which to record side exits.help
-C directory (in the manual page but not in --help)man
-X directoryCauses Ruby to switch to the directory. (in the manual page but not in --help)man
-F patternSpecifies input field separator ("$;"). (in the manual page but not in --help)man
-I directoryUsed to tell Ruby where to load the library scripts. (in the manual page but not in --help)man
-K kcodeSpecifies KANJI (Japanese) encoding. (in the manual page but not in --help)man
-USets the default value for internal encodings ("Encoding.default_internal") to UTF-8. (in the manual page but not in --help)man
-h (in the manual page but not in --help)man
-r libraryCauses Ruby to load the library using require. (in the manual page but not in --help)man
--disable-FEATURE (in the manual page but not in --help)man
--enable-FEATUREDisables (or enables) the specified FEATURE. (in the manual page but not in --help)man
--disable-gems (in the manual page but not in --help)man
--enable-gemsDisables (or enables) RubyGems libraries. (in the manual page but not in --help)man
--disable-rubyopt (in the manual page but not in --help)man
--enable-rubyoptIgnores (or considers) the RUBYOPT environment variable. (in the manual page but not in --help)man
--disable-all (in the manual page but not in --help)man
--enable-allDisables (or enables) all features. (in the manual page but not in --help)man

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.