Ruby on Rails 7 has introduced a new executable bin/dev. It won’t be present by default unless you create a new application with the --css option or run the css:install command.

This file calls the Foreman Gem which, in turn, executes the processes defined in the Procfile.dev at the root of your project.

This way of operating allows you to launch as many processes as you want in parallel, with a single command.

Here is an example of a Procfile from one of my projects.

web: bin/rails server -p 3000
css: bin/rails tailwindcss:watch
worker: bundle exec good_job start
guard: bundle exec guard
stripe: stripe listen --forward-to localhost:3000/pay/webhooks/stripe

All this works perfectly until the moment you need to debug your application with breakpoints. Foreman does not allow you to access the debug console of a particular process.

This is where Overmind comes into play. This program does exactly the same thing as Foreman while allowing you to connect to your processes.

Install Overmind on your machine as follows:

# on macOS (with homebrew)
$ brew install tmux

# on Ubuntu
$ apt-get install tmux

Then start your processes:

$ overmind s -f Procfile.dev

Overmind server command

I will now put a breakpoint in a Rails controller of the web process.

class HomeController < ApplicationController
  def index
    debugger
    # ...
  end
end

From another terminal, but in the same directory (where your Procfile.dev is located), run the following command:

$ overmind c web

Overmind connect command

You can now access the Ruby console! 🎉

Of course, this feature is not limited to Ruby and works with any program/language.