> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using the Interactive Ruby Shell to troubleshoot gems

> Learn how to use the Interactive Ruby Shell to troubleshoot your Ruby gem loading and configuration.

The Interactive Ruby Shell (irb) is a tool that enables you to interactively run Ruby programs and statements from the command line. This article describes how to use the Interactive Ruby Shell to troubleshoot Ruby gem loading and configuration.

## Basic Interactive Ruby Shell (irb) usage

To start irb, log in to your account [using SSH](/docs/using-ssh-secure-shell), and then type the following command:

```bash theme={null}
irb
```

<Tip>
  To debug a specific Ruby program, type the following command, where *program.rb* represents the name of the program you want to run:
</Tip>

```bash theme={null}
irb program.rb
```

The default irb command prompt appears:

```bash theme={null}
irb(main):001:0
```

From the irb prompt, you can run any Ruby statement and see the result immediately. For example, to view the value of the **\$0** global variable (which stores the name of the current Ruby program being run), type the following command:

```bash theme={null}
p $0
```

To exit irb, type the following command:

```bash theme={null}
exit
```

## Troubleshooting Gems

You can use irb to verify the Ruby environment is set up correctly for your gems. To do this, follow these steps:

1. At the command prompt, type the following command to start irb:

   ```bash theme={null}
   irb
   ```

2. At the irb prompt, type the following commands. Replace ***gem\_name*** with the name of the gem that you want to test:

   ```bash theme={null}
   require 'rubygems'
   require 'gem_name'
   ```

   > 🚧 Important
   >
   > For Ruby version 1.8, you must require rubygems **before** any other gems.

3. You receive one of the following results:

   * ```
     => true
     ```

     This result indicates that the environment is set up correctly, and Ruby is able to load the specified gem.

   * ```
     LoadError: no such file to load -- gem_name
     ```

     This result indicates that the environment is not set up correctly, and Ruby is unable to load the specified gem.

4. If you receive a **LoadError** message in step 3, type the following command:

   ```bash theme={null}
   p $LOAD_PATH
   ```

   The **$LOAD\_PATH** global variable stores an array that contains all of the directories Ruby searches when the **load** or **require** methods are called. Verify that the path to your gems is in **$LOAD\_PATH**. If it is not, you must configure the **GEM\_HOME** and **GEM\_PATH** environment variables to ensure the gems load correctly.

<Tip>
  For step-by-step instructions about how to configure Ruby gems on a hosting.com account, please see [this article](/docs/ruby-gems).
</Tip>

## More information

For more information about the Interactive Ruby Shell, please visit [http://ruby-doc.com/docs/ProgrammingRuby/html/irb.html](http://ruby-doc.com/docs/ProgrammingRuby/html/irb.html).

## Related articles

[Ruby gems](/docs/ruby-gems)
