{
    "mode": "man",
    "parameter": "IRB",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/IRB/1/json",
    "generated": "2026-10-22T13:23:51Z",
    "synopsis": "irb  [--version]  [-dfUw]  [-I  directory]  [-r library] [-E external[:internal]] [-W[level]]\n[--[no]inspect]  [--[no]multiline]   [--[no]singleline]   [--[no]echo]   [--[no]colorize]\n[--[no]autocomplete]     [--[no]verbose]    [--prompt    mode]    [--prompt-mode    mode]\n[--inf-ruby-mode] [--simple-prompt] [--noprompt] [--tracer] [--back-trace-limit  n]  [--]\n[programfile] [argument ...]",
    "sections": {
        "NAME": {
            "content": "irb — Interactive Ruby Shell\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "irb  [--version]  [-dfUw]  [-I  directory]  [-r library] [-E external[:internal]] [-W[level]]\n[--[no]inspect]  [--[no]multiline]   [--[no]singleline]   [--[no]echo]   [--[no]colorize]\n[--[no]autocomplete]     [--[no]verbose]    [--prompt    mode]    [--prompt-mode    mode]\n[--inf-ruby-mode] [--simple-prompt] [--noprompt] [--tracer] [--back-trace-limit  n]  [--]\n[programfile] [argument ...]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "irb is the REPL(read-eval-print loop) environment for Ruby programs.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "--version      Prints the version of irb.\n",
            "subsections": [
                {
                    "name": "-E _",
                    "content": "--encoding external[:internal]\nSame as `ruby -E' .  Specifies the default value(s) for external encodings and\ninternal encoding. Values should be separated with colon (:).\n\nYou   can   omit   the   one   for   internal   encodings,   then   the  value\n(Encoding.defaultinternal) will be nil.\n",
                    "flag": "-E"
                },
                {
                    "name": "-I _",
                    "content": "",
                    "flag": "-I"
                },
                {
                    "name": "-U",
                    "content": "(Encoding.defaultinternal) to UTF-8.\n",
                    "flag": "-U"
                },
                {
                    "name": "-d",
                    "content": "",
                    "flag": "-d"
                },
                {
                    "name": "-f",
                    "content": "",
                    "flag": "-f"
                },
                {
                    "name": "-w",
                    "content": "",
                    "flag": "-w"
                },
                {
                    "name": "-W",
                    "content": "",
                    "flag": "-W"
                },
                {
                    "name": "-h",
                    "content": "--help         Prints a summary of the options.\n",
                    "flag": "-h"
                },
                {
                    "name": "-r _",
                    "content": "--inspect      Uses `inspect' for output (default except for bc mode)\n\n--noinspect    Doesn't use inspect for output\n\n--multiline    Uses multiline editor module.\n\n--nomultiline  Doesn't use multiline editor module.\n\n--singleline   Uses singleline editor module.\n",
                    "flag": "-r"
                },
                {
                    "name": "--nosingleline",
                    "content": "Doesn't use singleline editor module.\n",
                    "long": "--nosingleline"
                },
                {
                    "name": "--extra-doc-dir",
                    "content": "Add an extra doc dir for the doc dialog.\n\n--echo         Show result (default).\n\n--noecho       Don't show result.\n",
                    "long": "--extra-doc-dir"
                },
                {
                    "name": "--echo-on-assignment",
                    "content": "Show result on assignment.\n",
                    "long": "--echo-on-assignment"
                },
                {
                    "name": "--noecho-on-assignment",
                    "content": "Don't show result on assignment.\n",
                    "long": "--noecho-on-assignment"
                },
                {
                    "name": "--truncate-echo-on-assignment",
                    "content": "Show truncated result on assignment (default).\n\n--colorize     Use colorization.\n\n--nocolorize   Don't use colorization.\n",
                    "long": "--truncate-echo-on-assignment"
                },
                {
                    "name": "--autocomplete",
                    "content": "Use autocompletion.\n",
                    "long": "--autocomplete"
                },
                {
                    "name": "--noautocomplete",
                    "content": "Don't use autocompletion.\n\n--verbose      Show details.\n\n--noverbose    Don't show details.\n\n--prompt mode\n--prompt-mode mode\nSwitch  prompt  mode.  Pre-defined prompt modes are `default', `simple', `xmp'\nand `inf-ruby'.\n",
                    "long": "--noautocomplete"
                },
                {
                    "name": "--inf-ruby-mode",
                    "content": "Uses prompt appropriate for inf-ruby-mode on  emacs.   Suppresses  --multiline\nand --singleline.\n",
                    "long": "--inf-ruby-mode"
                },
                {
                    "name": "--simple-prompt",
                    "content": "Makes prompts simple.\n\n--noprompt     No prompt mode.\n\n--tracer       Displays trace for each execution of commands.\n\n--back-trace-limit n\nDisplays backtrace top n and tail n.  The default value is 16.\n",
                    "long": "--simple-prompt"
                }
            ]
        },
        "ENVIRONMENT": {
            "content": "IRBLANG         The locale used for irb.\n\nIRBRC            The path to the personal initialization file.\n\nXDGCONFIGHOME  irb     respects     XDGCONFIGHOME.     If     this     is    set,    load\n$XDGCONFIGHOME/irb/irbrc as a personal initialization file.\n\nAlso irb depends on same variables as ruby(1).\n",
            "subsections": []
        },
        "FILES": {
            "content": "~/.irbrc\nPersonal irb initialization. If IRBRC is set, read $IRBRC instead. If  IRBRC  is  not\nset and XDGCONFIGHOME is set, $XDGCONFIGHOME/irb/irbrc is loaded.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "% irb\nirb(main):001:0> 1 + 1\n2\nirb(main):002:0> def t(x)\nirb(main):003:1> x + 1\nirb(main):004:1> end\n=> :t\nirb(main):005:0> t(3)\n=> 4\nirb(main):006:0> if t(3) == 4\nirb(main):007:1> p :ok\nirb(main):008:1> end\n:ok\n=> :ok\nirb(main):009:0> quit\n%\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "ruby(1).\n",
            "subsections": []
        },
        "REPORTING BUGS": {
            "content": "•   Security  vulnerabilities should be reported via an email to security@ruby-lang.org.  Re‐\nported problems will be published after being fixed.\n\n•   Other bugs and feature requests can be  reported  via  the  Ruby  Issue  Tracking  System\n(https://bugs.ruby-lang.org/).   Do  not  report security vulnerabilities via this system\nbecause it publishes the vulnerabilities immediately.\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Written by Keiju ISHITSUKA.\n\nUNIX                                       August 11, 2019                                    IRB(1)",
            "subsections": []
        }
    },
    "summary": "irb — Interactive Ruby Shell",
    "flags": [
        {
            "flag": "-E",
            "long": null,
            "arg": null,
            "description": "--encoding external[:internal] Same as `ruby -E' . Specifies the default value(s) for external encodings and internal encoding. Values should be separated with colon (:). You can omit the one for internal encodings, then the value (Encoding.defaultinternal) will be nil."
        },
        {
            "flag": "-I",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-U",
            "long": null,
            "arg": null,
            "description": "(Encoding.defaultinternal) to UTF-8."
        },
        {
            "flag": "-d",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-f",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-w",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-W",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-h",
            "long": null,
            "arg": null,
            "description": "--help Prints a summary of the options."
        },
        {
            "flag": "-r",
            "long": null,
            "arg": null,
            "description": "--inspect Uses `inspect' for output (default except for bc mode) --noinspect Doesn't use inspect for output --multiline Uses multiline editor module. --nomultiline Doesn't use multiline editor module. --singleline Uses singleline editor module."
        },
        {
            "flag": "",
            "long": "--nosingleline",
            "arg": null,
            "description": "Doesn't use singleline editor module."
        },
        {
            "flag": "",
            "long": "--extra-doc-dir",
            "arg": null,
            "description": "Add an extra doc dir for the doc dialog. --echo Show result (default). --noecho Don't show result."
        },
        {
            "flag": "",
            "long": "--echo-on-assignment",
            "arg": null,
            "description": "Show result on assignment."
        },
        {
            "flag": "",
            "long": "--noecho-on-assignment",
            "arg": null,
            "description": "Don't show result on assignment."
        },
        {
            "flag": "",
            "long": "--truncate-echo-on-assignment",
            "arg": null,
            "description": "Show truncated result on assignment (default). --colorize Use colorization. --nocolorize Don't use colorization."
        },
        {
            "flag": "",
            "long": "--autocomplete",
            "arg": null,
            "description": "Use autocompletion."
        },
        {
            "flag": "",
            "long": "--noautocomplete",
            "arg": null,
            "description": "Don't use autocompletion. --verbose Show details. --noverbose Don't show details. --prompt mode --prompt-mode mode Switch prompt mode. Pre-defined prompt modes are `default', `simple', `xmp' and `inf-ruby'."
        },
        {
            "flag": "",
            "long": "--inf-ruby-mode",
            "arg": null,
            "description": "Uses prompt appropriate for inf-ruby-mode on emacs. Suppresses --multiline and --singleline."
        },
        {
            "flag": "",
            "long": "--simple-prompt",
            "arg": null,
            "description": "Makes prompts simple. --noprompt No prompt mode. --tracer Displays trace for each execution of commands. --back-trace-limit n Displays backtrace top n and tail n. The default value is 16."
        }
    ],
    "examples": [
        "% irb",
        "irb(main):001:0> 1 + 1",
        "irb(main):002:0> def t(x)",
        "irb(main):003:1> x + 1",
        "irb(main):004:1> end",
        "=> :t",
        "irb(main):005:0> t(3)",
        "=> 4",
        "irb(main):006:0> if t(3) == 4",
        "irb(main):007:1> p :ok",
        "irb(main):008:1> end",
        ":ok",
        "=> :ok",
        "irb(main):009:0> quit"
    ],
    "see_also": [
        {
            "name": "ruby",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ruby/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Interactive Ruby shell.",
        "examples": [
            {
                "description": "Start the interactive shell",
                "command": "irb"
            },
            {
                "description": "Start the interactive shell with the simple prompt",
                "command": "irb --simple-prompt"
            },
            {
                "description": "Start the interactive shell without reading the configuration file",
                "command": "irb -f"
            },
            {
                "description": "Evaluate Ruby code read from `stdin`",
                "command": "echo \"{{puts 'Hello world'}}\" | irb --noecho"
            },
            {
                "description": "Display help",
                "command": "irb {{-h|--help}}"
            },
            {
                "description": "Display version",
                "command": "irb {{-v|--version}}"
            }
        ]
    }
}