LinuxCommandLibrary

brew-services

Manage background services for Homebrew packages

TLDR

List all services

$ brew services list
copy
Start a service
$ brew services start [postgresql]
copy
Stop a service
$ brew services stop [postgresql]
copy
Restart a service
$ brew services restart [postgresql]
copy
Run service in foreground
$ brew services run [postgresql]
copy
Stop all services
$ brew services stop --all
copy
Clean up unused services
$ brew services cleanup
copy

SYNOPSIS

brew services [subcommand] [formula] [options]

DESCRIPTION

brew services manages background services for installed Homebrew formulae. On macOS, it uses launchd with LaunchAgent plist files. On Linux, it uses systemd user units.
Services configured with this command start automatically on user login.

PARAMETERS

--all

Apply to all services
--json
Output in JSON format
--file path
Use custom service file

SUBCOMMANDS

list

List all managed services and their status
start formula
Start service and configure for login startup
stop formula
Stop service and disable login startup
restart formula
Restart service
run formula
Run service in foreground (no login startup)
cleanup
Remove unused service files
info formula
Show service information

SERVICE FILES

macOS

~/Library/LaunchAgents/homebrew.mxcl.<formula>.plist
Linux
~/.config/systemd/user/homebrew-<formula>.service

CAVEATS

On Linux, requires a running user systemd instance. Common use cases include databases (postgresql, mysql), caches (redis), and web servers. Use run for development to avoid startup configuration.

HISTORY

Introduced in Homebrew 0.9.9 (February 2014) for macOS launchd support. Linux/systemd support was added via Linuxbrew and merged into core Homebrew by 2020.

SEE ALSO

brew(1), launchctl(1), systemctl(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community