Legacy Rails Maintenance Notes: Bundler, Homebrew, and MySQL

This is a maintenance note for older Rails projects. MySQL 5.7 reached end of life in October 2023, so installing it today should be a temporary compatibility measure, not an architectural vision.

Skip Homebrew auto-update for one command

1
HOMEBREW_NO_AUTO_UPDATE=1 brew install <formula>

This saves time in a controlled environment, but skipping updates permanently also skips security and formula fixes. Use it intentionally, not as a lifestyle.

Why bundle exec matters

1
bundle exec rspec

Bundler activates the gem versions recorded in Gemfile.lock. Running rspec directly may execute another globally installed version.

Binstubs provide a shorter project-scoped command:

1
2
bundle binstubs rspec-core
bin/rspec

Running a legacy MySQL version

Prefer a container or isolated environment so an obsolete database does not replace the supported system version:

1
2
3
4
5
6
7
8
services:
mysql:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: local-development-only
MYSQL_DATABASE: legacy_app_development
ports:
- "3307:3306"

Never use that development password in production.

If Homebrew is unavoidable, use the versioned formula while it remains available:

1
2
brew install mysql@5.7
brew services start mysql@5.7

Rebuild native gems against the selected client libraries:

1
2
3
bundle config set --local build.mysql2 \
--with-mysql-config="$(brew --prefix mysql@5.7)/bin/mysql_config"
bundle pristine mysql2

Do not begin with rm -rf /usr/local/var/mysql. That directory may contain every local database you forgot to back up, and deletion is a very efficient migration strategy in the wrong direction.

Migration checks

Rails can raise when pending migrations exist:

1
config.active_record.migration_error = :page_load

Disabling the check with false hides the warning; it does not make the schema current. Use that only when another deployment process guarantees migrations.

References