Overmind + Foreman + Rails = Happy Team When you generate a new Rails 7.1 app, you have a binstub called bin/dev. The binstub is responsible for launching your development tools defined in Procfile.dev. By default, Rails uses Foreman to start your app. Overmind is a better alternative to Foreman. Your project can support both at the same time, so your team won’t hate you. Here’s how.

What is Foreman?

Manage Procfile-based applications

In a nutshell, it’s a manager for any process that your Rails app needs. It hasn’t been updated in a couple of years already.

What is Overmind?

Overmind is a process manager for Procfile-based applications and tmux.

It’s an alternative that is more advanced. It is updated more regularly, so I recommend it to anyone starting a new Rails project.

Co-using Overmind in your Rails project along with Foreman


Install Overmind (macOS):

brew install overmind

Note: you don’t need to add anything to your Gemfile.

Tweak bin/dev

Every time I generate a new Rails 7.1 project, I replace bin/dev with the following content:

#!/usr/bin/env sh

# Default to port 3000 if not specified
export PORT="${PORT:-3000}"

if command -v overmind &> /dev/null
  overmind start -f Procfile.dev "$@"
  exit $?

if ! gem list foreman -i --silent; then
  echo "Installing foreman..."
  gem install foreman

foreman start -f Procfile.dev "$@"

In this updated version of bin/dev, we added support for Overmind while still maintaining Foreman support.

If you have Overmind installed, it will use that.

If you don’t have it installed, Foreman will be used as a fallback.

Now you can open a PR against your Rails repository and be happy that your teammates don’t hate you if they prefer Foreman instead.

Share on: