To run a different installed Homebrew formula version as a macOS background service, stop the current formula’s service, start the versioned formula by its own name, then confirm which service is running. For example, if both postgresql@16 and postgresql@17 are installed, use brew services stop postgresql@16 followed by brew services start postgresql@17. Homebrew’s service manager uses macOS launchd; without sudo, it registers services to run at your login. Homebrew’s brew(1) manual
1. Find the installed formula names
Use Homebrew’s own records to check what is installed and how the formula names are spelled:
brew list --versions
brew info postgresql@16
brew info postgresql@17
Replace the examples with your service’s formula names. A versioned formula is a separate Homebrew formula, commonly written with an @ suffix; it is not a command to select an arbitrary historical version of one formula. The available versioned formulae depend on what Homebrew currently provides. Homebrew also describes versioned formulae as a limited set, and some may be removed over time. Homebrew Formulae Versions
Before switching, inspect each formula’s brew info output for its service details and any migration notes. A new formula name does not guarantee that the service can reuse the old version’s data directory or configuration. Database and server software may have application-specific upgrade or downgrade requirements; follow that software’s documented migration process before starting the other version against existing data.
2. Stop one formula’s service and start the other
Run the service commands without sudo for a service that starts at your login:
brew services stop postgresql@16
brew services start postgresql@17
brew services list
Use the actual installed formula tokens in place of the PostgreSQL examples. brew services stop and start take the formula name, so this selects the service associated with the target formula. The list command lets you inspect Homebrew’s reported service status afterward. The manual documents service management through launchd and notes that the non-sudo setup uses ~/Library/LaunchAgents, so it is scoped to the current user’s login. Homebrew’s brew(1) manual
If the target version is installed but its service is not running, start it directly. If a restart is desired for the same formula, brew services restart FORMULA is documented; when changing versions, explicitly stopping the old formula and starting the new one makes the intended transition clear. Do not use brew services restart --all for a single-service switch because it affects every Homebrew service.
3. Understand the distinction between service and command selection
Starting a versioned formula as a service does not necessarily make its command-line tools the default in Terminal. Homebrew installs each formula into a versioned Cellar keg. Linking a formula creates symlinks in Homebrew’s shared prefix, while some versioned formulae are marked keg-only and are not linked there by default. Homebrew’s brew(1) manual, Homebrew FAQ: What does “keg-only” mean?
Check brew info FORMULA for whether the formula is keg-only and any provided PATH guidance. If you only need the background service to use the other version, manage its service by formula name; do not assume that changing links is required. Avoid brew link --force as a generic switching step: Homebrew warns that forcing a keg-only formula into shared directories can create conflicts. Homebrew’s keg-only dependency guidance
4. If the target service fails to start
First check brew services list and the target formula’s brew info output. Confirm the old service stopped and that the new formula actually provides a service definition; Homebrew’s service support depends on a formula having a service configuration. Homebrew Formula Cookbook
Next, check the application’s own logs and configuration. A service can fail even when the formula is installed—for example, because its configuration points to a different data directory, the port is already in use, or a version cannot open the existing data. These are application-level possibilities, not fixes guaranteed by Homebrew; use the application’s official documentation before changing or deleting data.
Use sudo brew services only when you intentionally need a system-wide service that starts at boot. Homebrew documents this mode as operating in /Library/LaunchDaemons, while the default user service is launched at login. Most personal development services should be managed under the user account that owns their files. Homebrew’s brew(1) manual
A successful switch therefore has two checks: Homebrew reports the intended formula running, and the application itself responds as expected. Service status alone does not validate data compatibility or prove that command-line clients now resolve to that formula version.
Sources
Homebrew Documentation: brew(1) – The Package Manager for Everywhere — Homebrew
Homebrew Documentation: Formulae Versions — Homebrew
Homebrew Documentation: FAQ — Homebrew
Homebrew Documentation: Building Software with Homebrew Keg-Only Dependencies — Homebrew
Homebrew Documentation: Formula Cookbook — Homebrew