brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: brew services runs a Homebrew database or server in the background on your Mac

Terminal
~/tips/tip-terminal-brew-services

brew services start redis

Starts, stops and lists background services installed with Homebrew.

Installed Redis or PostgreSQL with Homebrew and now it isn’t running after a reboot? brew services manages them as launchd agents, without writing a plist yourself.

Start a service now and at every login:

brew services start redis
brew services list

list shows each service with its status, user and the plist file it uses. stop stops it and removes it from login, and restart is the one to use after changing a config file.

For something that should only last this session, I’d use run instead of start. It starts the service but doesn’t register it to come back after a reboot, which keeps a laptop lean:

brew services run postgresql@16
brew services stop postgresql@16

brew services info redis shows the details of one service, including where its log ends up when it refuses to start.

Without sudo the plist goes into ~/Library/LaunchAgents and runs as you, at login. With sudo it becomes a system service that starts at boot and runs as root unless configured otherwise, which is rarely what you want for a development database. If a service seems to start twice or a port is taken, check whether you started it both ways.

Further reading: brew manpage (Homebrew docs)

More Terminal tips ioreg -rn AppleSmartBattery | grep CycleCount Terminal can save your windows and tabs as a window group Export a Terminal profile to a .terminal file and import it on another Mac mc hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}' All Terminal tips (116) All topics

Link