OS Manuals

/usr/bin/ruby

the Ruby programming language

From ruby-3.2 3.2.11-r9 (os), captured 2026-11-05 by running ruby --help (exit 0). permalink

Usage: /usr/bin/ruby [switches] [--] [programfile] [arguments]
  -0[octal]       specify record separator (\0, if no argument)
  -a              autosplit mode with -n or -p (splits $_ into $F)
  -c              check syntax only
  -Cdirectory     cd to directory before executing your script
  -d, --debug     set debugging flags (set $DEBUG to true)
  -e 'command'    one line of script. Several -e's allowed. Omit [programfile]
  -Eex[:in], --encoding=ex[:in]
                  specify the default external and internal character encodings
  -Fpattern       split() pattern for autosplit (-a)
  -i[extension]   edit ARGV files in place (make backup if extension supplied)
  -Idirectory     specify $LOAD_PATH directory (may be used more than once)
  -l              enable line ending processing
  -n              assume 'while gets(); ... end' loop around your script
  -p              assume loop like -n but print line also like sed
  -rlibrary       require the library before executing your script
  -s              enable some switch parsing for switches after script name
  -S              look for the script using PATH environment variable
  -v              print the version number, then turn on verbose mode
  -w              turn warnings on for your script
  -W[level=2|:category]
                  set warning level; 0=silence, 1=medium, 2=verbose
  -x[directory]   strip off text before #!ruby line and perhaps cd to directory
  --jit           enable JIT for the platform, same as --yjit
  --mjit          enable C compiler-based JIT compiler (experimental)
  --yjit          enable in-process JIT compiler
  --copyright     print the copyright
  --dump={insns|parsetree|...}[,...]
                  dump debug information. see below for available dump list
  --enable={jit|rubyopt|...}[,...], --disable={jit|rubyopt|...}[,...]
                  enable or disable features. see below for available features
  --external-encoding=encoding, --internal-encoding=encoding
                  specify the default external or internal character encoding
  --backtrace-limit=num
                  limit the maximum length of backtrace
  --verbose       turn on verbose mode and disable script from stdin
  --version       print the version number, then exit
  --help          show this message, -h for short message
Dump List:
  insns           instruction sequences
  insns_without_opt
                  instruction sequences compiled with no optimization
  yydebug(+error-tolerant)
                  yydebug of yacc parser generator
  parsetree(+error-tolerant)
                  AST
  parsetree_with_comment(+error-tolerant)
                  AST with comments
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)
  mjit            C compiler-based JIT compiler (default: disabled)
  yjit            in-process JIT compiler (default: disabled)
Warning categories:
  deprecated      deprecated features
  experimental    experimental features
MJIT options (experimental):
  --mjit-warnings Enable printing JIT warnings
  --mjit-debug    Enable JIT debugging (very slow), or add cflags if specified
  --mjit-wait     Wait until JIT compilation finishes every time (for testing)
  --mjit-save-temps
                  Save JIT temporary files in $TMP or /tmp (for testing)
  --mjit-verbose=num
                  Print JIT logs of level num or less to stderr (default: 0)
  --mjit-max-cache=num
                  Max number of methods to be JIT-ed in a cache (default: 100)
  --mjit-call-threshold=num
                  Number of calls to trigger JIT (for testing, default: 10000)
YJIT options:
  --yjit-stats    Enable collecting YJIT statistics
  --yjit-exec-mem-size=num
                  Size of executable memory block in MiB (default: 64)
  --yjit-call-threshold=num
                  Number of calls to trigger JIT (default: 10)
  --yjit-max-versions=num
                  Maximum number of versions per basic block (default: 4)
  --yjit-greedy-versioning
                  Greedy versioning mode (default: disabled)
Options (60)
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
-Cdirectorycd to directory before executing your scripthelp
-d, --debugset debugging flags (set $DEBUG to true)help + man + man
-e 'command'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 :inspecify the default external and internal character encodingshelp
-Fpatternsplit() pattern for autosplit (-a)help
-i extensionedit ARGV files in place (make backup if extension supplied)help + man
-Idirectoryspecify $LOAD_PATH directory (may be used more than once)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 library before executing your scripthelp
-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
-vprint the version number, then turn on verbose modehelp + man
-wEnables verbose mode without printing version message at the beginning.help + man
-W level=2|:categoryset warning level;help
-x directorystrip off text before #!ruby line and perhaps cd to directoryhelp
--jitenable JIT for the platform, same as --yjithelp
--mjitenable C compiler-based JIT compiler (experimental)help
--yjitenable in-process JIT compilerhelp
--copyrightPrints the copyright notice, and quits immediately without running any script.help + man
--dump insns|parsetree|...dump debug information.help + man
--enable, --disable jit|rubyopt|...enable or disable features.help
--external-encoding, --internal-encoding encodingspecify the default external or internal character encodinghelp + man + man
--backtrace-limit numlimit the maximum length of backtracehelp
--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
--helpshow this message, -h for short messagehelp + man
--mjit-debugEnable JIT debugging (very slow), or add cflags if specifiedhelp
--mjit-waitWait until JIT compilation finishes every time (for testing)help
--mjit-save-tempsSave JIT temporary files in $TMP or /tmp (for testing)help
--mjit-verbose numPrint JIT logs of level num or less to stderr (default: 0)help
--mjit-max-cache numMax number of methods to be JIT-ed in a cache (default: 100)help
--mjit-call-threshold numNumber of calls to trigger JIT (for testing, default: 10000)help
--yjit-statsEnable collecting YJIT statisticshelp
--yjit-exec-mem-size numSize of executable memory block in MiB (default: 64)help
--yjit-call-threshold numNumber of calls to trigger JIT (default: 10)help
--yjit-max-versions numMaximum number of versions per basic block (default: 4)help
--yjit-greedy-versioningGreedy versioning mode (default: disabled)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
-y (in the manual page but not in --help)man
--yydebugDO NOT USE. (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.