---
title: Rails Without Ruby
author: Victor Cobos
tags: Rails, Docker, Ruby, Dev Containers
published_at: '2025-09-10T10:00:00+02:00'
updated_at: '2025-09-10T10:25:26+02:00'
canonical_url: https://www.dotruby.com/articles/rails-without-ruby
---

# Rails Without Ruby

Yes, you can run Rails without installing Ruby. With VS Code devcontainers, your whole Rails setup lives inside Docker — no version managers, no system dependencies, just rails new and go.

When [Rails 7.2](https://rubyonrails.org/2024/8/6/Rails-7-2-0-rc-1-has-been-released) shipped, it quietly added something that makes life a lot easier for developers: native support for [development containers](https://containers.dev) (or dev containers for short).

If you’ve ever onboarded to a new Rails project, you probably know the drill: install the right version of Ruby, fight with system dependencies, get Node and a JavaScript bundler working, set up PostgreSQL… only then can you finally type rails new. It’s a lot, especially for beginners.

With devcontainers, that setup pain just disappears. A devcontainer is simply a Docker environment tailored for development. It comes with Ruby, Node, a database, Redis, and even Headless Chrome ready to go — all isolated from your machine. And starting with Rails 7.2, you don’t even have to write the config yourself. Just run:

```bash
rails new myapp --devcontainer
```

Rails will generate a `.devcontainer` folder for you, complete with `Dockerfile`, `compose.yml` and `devcontainer.json` to run everything out of the box. No Ruby required on your host machine.

For existing applications, a `devcontainer` command is now available:

```shell
rails devcontainer
```

This command **only generates the .devcontainer folder and its files** (`Dockerfile`, `compose.yml`, `devcontainer.json`). It doesn’t touch the rest of your app.

## What You Need to Run a Devcontainer

The beauty of devcontainers is that your host machine doesn’t need Ruby, Node, or even a database installed. All you need is:

* **A container runtime** – usually that means [Docker Desktop](https://www.docker.com/products/docker-desktop/), but you can also use lighter or faster alternatives like [Colima](https://github.com/abiosoft/colima) or [OrbStack](https://orbstack.dev) (which I use). They all provide the same underlying container support.
* **VS Code** – with the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) (or any other editor that understands devcontainers, but VS Code has the smoothest experience).

No `rbenv`, no `rvm`, no fiddling with Homebrew packages. Once your container runtime is running, VS Code will recognize the `.devcontainer` folder in your project and prompt you to **“Reopen in Container”**. From there, you’re inside a fully configured Rails environment.

So now you know: with Rails 7.2, a `devcontainer` can take care of your entire setup — no local Ruby required. All you need is Docker (or Colima, or OrbStack) and VS Code.

But that leaves us with one final question:

👉 **How do you actually generate the devcontainer setup for a brand-new Rails app, or even for an existing one, if Ruby isn’t installed on your machine at all?**

## Rails New: The Standalone Rails Generator

When you usually type `rails new`, you’re relying on the rails gem that’s already installed on your system. But what if you don’t have Ruby or Rails installed locally? That’s where [rails-new](https://github.com/rails/rails-new) comes in.

**Rails New** is a standalone command-line tool published as a Ruby gem. Its whole job is to let you generate a brand-new Rails application without requiring a global Rails installation.

### Installation

Go to the  [latest release](https://github.com/rails/rails-new/releases) and download the executable for your platform (not the source code). For example, on M1 macOS this would be `rails-new-aarch64-apple-darwin.tar.gz`.

Once the download is complete, unzip the `.tar.gz` file, which will create the `rails-new` executable. Move this executable somewhere on your system (for example, `~/bin` or `/usr/local/bin`).

Finally, make sure it’s available in your terminal by adding it to your `PATH`. You can do this by adding a line like this to your shell config (`~/.zshrc` or `~/.bashrc`):

```bash
export PATH="$PATH:/path-to-executable/rails-new"
```

After reloading your shell (`source ~/.zshrc`), you’ll be able to run `rails-new` from anywhere.

### Usage

Once installed, it’s super simple:

```bash
rails-new myapp --devcontainer
```

This command uses Docker behind the scenes to generate your new Rails application—without requiring Ruby or Rails installed on your local machine.

The `rails-new` executable is just a wrapper around the official Rails application generator. That means you can pass any of the usual rails new options to it — exactly like you would if you had Rails installed locally.
You can see all of the command line options that the Rails application generator accepts by running `rails-new --help`.



## Generating a Rails App with Just Docker

If you don’t want to download rails-new, you can still generate a new Rails app using nothing but Docker. The trick is to:

### Start a Ruby container
From the directory where you want your project created, run:

```bash
docker run --rm -it -v "$PWD":/app -w /app ruby:3.4 bash
```

**What this does:**
	•	`docker run --rm -it` → run an interactive container that gets removed after exit.
	•	`-v "$PWD":/app` → mount your current directory into `/app` inside the container.
	•	`-w /app` → set the working directory.
	•	`ruby:3.4` → use the official Ruby image (you can pick another version if you like).

### Install Rails inside the container
Once inside the container, install Rails with:

```bash
gem install rails
```

### Generate a new Rails application
Now create your app just like you normally would:

```bash
rails new myapp --devcontainer
```

This will generate a new `myapp` folder inside your mounted directory, complete with Rails 7.2’s `.devcontainer` setup.

### Exit the container
Type `exit` to return to your host machine. Your Rails project is now available locally in the `myapp` folder.

Open it in `VS Code` and choose **“Reopen in Container”** — and you’re ready to run Rails, no Ruby installed on your machine. 🎉


## Conclusion

`Devcontainers` change the way we think about setting up Rails. Instead of every developer wrestling with Ruby versions, Node, databases, and native dependencies on their own machine, you can now define a single, reproducible environment that works everywhere.

For teams, this means everyone shares the same setup — no more “works on my machine” problems, and onboarding new developers becomes as easy as cloning the repo and clicking **“Reopen in Container”**. Even if someone has never touched Rails before, they can be productive right away without having to fight through environment setup.

For individuals, devcontainers make it incredibly simple to experiment. Want to try Rails for the first time? Curious about a new release? You don’t need to install Ruby or worry about breaking your current system — just spin up the devcontainer and you have a fully isolated, ready-to-use environment in minutes.

The bottom line: you can now run Rails without ever installing Ruby locally. That makes Rails more accessible, more consistent, and a lot faster to get started with than ever before.

Give it a try today — spin up a Rails app with a devcontainer and see how easy it is to run Rails without Ruby installed locally. 🚀

## Resources

* [Getting Started with Dev Containers](https://guides.rubyonrails.org/getting_started_with_devcontainer.html)
* [How to use Dev Containers with Rails](https://gorails.com/episodes/how-to-use-dev-containers-with-rails)
* [Setting Up Rails with Dev Containers](https://www.fastruby.io/blog/setting-up-dev-containers-for-rails.html)
* [The Complete Guide to Dev Containers in Ruby on Rails](https://www.rorvswild.com/blog/2025/dev-containers-rails)
