---
title: Install the New Relic Ruby agent
source: https://docs.newrelic.com/docs/apm/agents/ruby-agent/installation/install-new-relic-ruby-agent
---

The Ruby agent auto-instruments your code so you can start monitoring applications.

> #### 💡 TIP
>
> Running on Kubernetes? See [Kubernetes APM auto-attach](https://docs.newrelic.com/docs/kubernetes-pixie/kubernetes-integration/installation/k8s-agent-operator/).

## Prerequisites [#prerequisites]

Check these requirements before you start.

| Requirement           | Details                                                                                                                                                                                                                                                 |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **New Relic account** | You need a [New Relic account](https://newrelic.com/signup) and your license key. Have it ready before you begin.                                                                                                                                       |
| **Ruby version**      | See [Ruby agent requirements and supported frameworks](https://docs.newrelic.com/docs/apm/agents/ruby-agent/getting-started/ruby-agent-requirements-supported-frameworks) for supported Ruby versions.                                                  |
| **Operating system**  | UNIX-like operating systems: Linux, Solaris, FreeBSD, and macOS. See [Ruby agent requirements and supported frameworks](https://docs.newrelic.com/docs/apm/agents/ruby-agent/getting-started/ruby-agent-requirements-supported-frameworks) for details. |

## Install the gem [#install]

Add the Ruby agent gem to your Gemfile:

````ruby
gem 'newrelic_rpm'
```

Then run:

```sh
bundle install
```

<Callout variant="important">
  If you are using the agent in a Docker container, install the agent within each container. See [Install in GAE flexible environment](/docs/apm/agents/ruby-agent/installation/install-new-relic-ruby-agent-gae-flexible-environment) for a Docker-based deployment example.
</Callout>

**Framework-specific notes:**

* **Rails**: Rails automatically calls `Bundler.require`, so `newrelic_rpm` is required during startup with no additional steps.
* **Roda or Sinatra**: You must manually call `require 'newrelic_rpm'` in your application.
* **Other Rack apps**: To use automatic browser monitoring, manually include the [Rack middlewares](/docs/agents/ruby-agent/frameworks/rack-middlewares#manual) provided by the agent.

````

## Configure the agent [#configure]

Download [`newrelic.yml`](https://github.com/newrelic/newrelic-ruby-agent/blob/dev/newrelic.yml) from the New Relic GitHub repository and copy it into the `config` directory of your application.

The only two settings you **must** change before going live:

1.  Set `license_key` to your license key.
2.  Set `app_name` to a meaningful name for your application.

    Alternatively, generate the config file with the CLI:

    ```sh
    newrelic install --license_key="YOUR_LICENSE_KEY" "YOUR_APP_NAME"
    ```

## Verify data is flowing [#verify]

1.  Restart your web server.

2.  Send at least two requests to your application.

3.  Wait 2–3 minutes, then open [one.newrelic.com > APM](https://one.newrelic.com/apm) and look for your app by name.

    > #### 💡 TIP
    >
    > App not appearing? See [No data appears (Ruby)](https://docs.newrelic.com/docs/apm/agents/ruby-agent/troubleshooting/no-data-appears-ruby).

## Related articles [#related-docs]

-   [Ruby agent requirements and supported frameworks](https://docs.newrelic.com/docs/apm/agents/ruby-agent/getting-started/ruby-agent-requirements-supported-frameworks) — Supported Ruby versions, operating systems, and frameworks.
-   [Ruby agent configuration](https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration) — All available configuration settings.
-   [Update the Ruby agent](https://docs.newrelic.com/docs/apm/agents/ruby-agent/installation/update-ruby-agent) — How to upgrade to a newer version.
-   [Ruby agent on Heroku](https://docs.newrelic.com/docs/apm/agents/ruby-agent/installation/ruby-agent-heroku) — Installation steps specific to Heroku.
