first, check if your OS is running brew (shorted version of homebrew (page - https://brew.sh/ to find more information)].
To verify it, please, run in your terminal:
brew version:
bash-3.2$> brew -v
Homebrew X.X.XX
If it matches for you, consider using next brew subcommand:
Brew services
bash-3.2$ brew services
Description (extraction from man brew help information)
brew services [subcommand]
Manage background services with macOS’ launchctl(1) daemon manager or
Linux’s systemctl(1) service manager.
Example of use:
bash-3.2$ brew services list
Name Status User File
[email protected] none
postgresql@XX started [LOCAL_USER]
redis none
Note: Verify your PostgreSQL version with format: @XX and current service status: [none|started|...].
Identify in this command if you have a service running that matches, in this case, to Postgres, and it will look as above example.
Stop service
Please, this command will attempt to stop your service. Use it wisely, make sure you navigated first brew services stop documentation, and properly scoped the impact of this command in your current environment.
Description (extraction from man brew help information)
[sudo] brew services stop (formula|--all):
Stop the service formula immediately and unregister it from launching at
login (or boot).
Example of use:
Stop a service
brew services stop postgresql@15
Huge mention to @Ciara Spencer (https://stackoverflow.com/users/14436643/ciara-spencer).
Happy coding!