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

# Ruby

> Ruby can be automatically configured by Devbox via the built-in Ruby Plugin. This plugin will activate automatically when you install Ruby 2.7 using `devbox add ruby`.

[**Example Repo**](https://github.com/jetify-com/devbox/tree/main/examples/development/ruby)

## Adding Ruby to your shell[​](#adding-ruby-to-your-shell "Direct link to Adding Ruby to your shell")

Run `devbox add ruby@3.1 bundler`, or add the following to your `devbox.json`

```json theme={null}
    "packages": [
        "ruby@3.1",
        "bundler@latest"
    ]
```

This will install Ruby 3.1 to your shell. You can find other installable versions of Ruby by running
`devbox search ruby`. You can also view the available versions on
[Nixhub](https://www.nixhub.io/packages/ruby)

## Ruby Plugin Support[​](#ruby-plugin-support "Direct link to Ruby Plugin Support")

Devbox will automatically create the following configuration when you install Ruby with
`devbox add`.

### Environment Variables[​](#environment-variables "Direct link to Environment Variables")

These environment variables configure Gem to install your gems locally, and set your Gem Home to a
local folder

```bash theme={null}
RUBY_CONFDIR={PROJECT_DIR}/.devbox/virtenv/ruby
GEMRC={PROJECT_DIR}/.devbox/virtenv/ruby/.gemrc
GEM_HOME={PROJECT_DIR}/.devbox/virtenv/ruby
PATH={PROJECT_DIR}/.devbox/virtenv/ruby/bin:$PATH
```

### Disabling the Ruby Plugin[​](#disabling-the-ruby-plugin "Direct link to Disabling the Ruby Plugin")

You can disable the Ruby plugin by running `devbox add ruby --disable-plugin`, or by setting the
`disable_plugin` field in your `devbox.json`:

```json theme={null}
{
  "packages": {
    "ruby": {
      "version": "3.1",
      "disable_plugin": true
    },
    "bundler": {
      "version": "latest"
    }
  }
}
```

## Bundler[​](#bundler "Direct link to Bundler")

In case you are using bundler to install gems, bundler config file can still be used to pass configs
and flags to install gems.

`.bundle/config` file example:

```yaml theme={null}
BUNDLE_BUILD__SASSC: "--disable-lto"
```

[Edit this page](https://github.com/jetify-com/docs/tree/main/docs/devbox/devbox-examples/languages/ruby/index.mdx)
