IRB(1) UNIX IRB(1)

# [NAME](#NAME)

**irb** - Interactive Ruby Shell

# [SYNOPSIS](#SYNOPSIS)

**irb** \[**--version**] \[**-dfUw**] \[**-I** *directory*] \[**-r** *library*] \[**-E** *external*\[:*internal*]] \[**-W**\[*level*]] \[**--**\[no]inspect] \[**--**\[no]multiline] \[**--**\[no]singleline] \[**--**\[no]echo] \[**--**\[no]colorize] \[**--**\[no]autocomplete] \[**--**\[no]verbose] \[**--prompt** *mode*] \[**--prompt-mode** *mode*] \[**--inf-ruby-mode**] \[**--simple-prompt**] \[**--noprompt**] \[**--tracer**] \[**--back-trace-limit** *n*] \[**--**] \[program\_file] \[argument ...]

# [DESCRIPTION](#DESCRIPTION)

**irb** is the REPL(read-eval-print loop) environment for Ruby programs.

# [OPTIONS](#OPTIONS)

[**--version**](#version)

Prints the version of **.**

[**-E** *external*\[:*internal*\]](#E)

[**--encoding** *external*\[:*internal*\]](#encoding)

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.default\_internal") will be nil.

[**-I** *path*](#I)

Same as \`ruby -I' . Specifies $LOAD\_PATH directory

[**-U**](#U)

Same as \`ruby -U' . Sets the default value for internal encodings ("Encoding.default\_internal") to UTF-8.

[**-d**](#d)

Same as \`ruby -d' . Sets $DEBUG to true.

[**-f**](#f)

Suppresses read of *~/.irbrc*.

[**-w**](#w)

Same as \`ruby -w' .

[**-W**](#W)

Same as \`ruby -W' .

[**-h**](#h)

[**--help**](#help)

Prints a summary of the options.

[**-r** *library*](#r)

Same as \`ruby -r'. Causes irb to load the library using require.

[**--inspect**](#inspect)

Uses \`inspect' for output (default except for bc mode)

[**--noinspect**](#noinspect)

Doesn't use inspect for output

[**--multiline**](#multiline)

Uses multiline editor module.

[**--nomultiline**](#nomultiline)

Doesn't use multiline editor module.

[**--singleline**](#singleline)

Uses singleline editor module.

[**--nosingleline**](#nosingleline)

Doesn't use singleline editor module.

[**--extra-doc-dir**](#extra_doc_dir)

Add an extra doc dir for the doc dialog.

[**--echo**](#echo)

Show result (default).

[**--noecho**](#noecho)

Don't show result.

[**--echo-on-assignment**](#echo_on_assignment)

Show result on assignment.

[**--noecho-on-assignment**](#noecho_on_assignment)

Don't show result on assignment.

[**--truncate-echo-on-assignment**](#truncate_echo_on_assignment)

Show truncated result on assignment (default).

[**--colorize**](#colorize)

Use colorization.

[**--nocolorize**](#nocolorize)

Don't use colorization.

[**--autocomplete**](#autocomplete)

Use autocompletion.

[**--noautocomplete**](#noautocomplete)

Don't use autocompletion.

[**--regexp-completor**](#regexp_completor)

Use regexp based completion.

[**--type-completor**](#type_completor)

Use type based completion.

[**--verbose**](#verbose)

Show details.

[**--noverbose**](#noverbose)

Don't show details.

[**--prompt** *mode*](#prompt)

[**--prompt-mode** *mode*](#prompt_mode)

Switch prompt mode. Pre-defined prompt modes are \`default', \`simple', \`xmp' and \`inf-ruby'.

[**--inf-ruby-mode**](#inf_ruby_mode)

Uses prompt appropriate for inf-ruby-mode on emacs. Suppresses --multiline and --singleline.

[**--simple-prompt**](#simple_prompt)

Makes prompts simple.

[**--noprompt**](#noprompt)

No prompt mode.

[**--tracer**](#tracer)

Displays trace for each execution of commands.

[**--back-trace-limit** *n*](#back_trace_limit)

Displays backtrace top *n* and tail *n*. The default value is 16.

# [ENVIRONMENT](#ENVIRONMENT)

[**IRB\_LANG**](#IRB_LANG)

The locale used for **.**

[**IRBRC**](#IRBRC)

The path to the personal initialization file.

[**XDG\_CONFIG\_HOME**](#XDG_CONFIG_HOME)

**irb** respects XDG\_CONFIG\_HOME. If this is set, load *$XDG\_CONFIG\_HOME/irb/irbrc* as a personal initialization file.

Also **irb** depends on same variables as [**ruby**(1)](/man/os/ruby-3.3/ruby.1).

# [FILES](#FILES)

**~/.irbrc**

Personal irb initialization. If *IRBRC* is set, read *$IRBRC* instead. If *IRBRC* is not set and *XDG\_CONFIG\_HOME* is set, *$XDG\_CONFIG\_HOME/irb/irbrc* is loaded.

# [EXAMPLES](#EXAMPLES)

```
  % irb
```

```
  irb(main):001:0> 1 + 1
```

```
  2
```

```
  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](#SEE_ALSO)

[**ruby**(1)](/man/os/ruby-3.3/ruby.1).

# [REPORTING BUGS](#REPORTING_BUGS)

- Security vulnerabilities should be reported via an email to Mt security@ruby-lang.org. Reported problems will be published after being fixed.
- Other bugs and feature requests can be reported via the Ruby Issue Tracking System (**https://bugs.ruby-lang.org/**). Do not report security vulnerabilities via this system because it publishes the vulnerabilities immediately.

# [AUTHORS](#AUTHORS)

Written by Keiju ISHITSUKA.

Ruby Programmer's Reference Guide August 11, 2019

---

Document: irb(1) from ruby-3.3 3.3.13-r2 (Chainguard OS)
Source: https://github.com/ruby/ruby
