Is it bad to call sudo on 'sudo brew services start --all'?
I had a bug running redis and I stopped all servies with sudo brew services stop --all
and installed redis fresh.
Now I wanted to start all servies again with sudo brew services start --all
but I'm not able to use Laravel Valet (a program to show a website with .test domains) at all.
I get errors like:
the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/etc/nginx/nginx.conf:1
So that is my question: Is it bad to call sudo on 'sudo brew services start --all'?
Yes, it is bad, at least according to the Homebrew FAQ:
Why does Homebrew say sudo is bad?
tl;dr Sudo is dangerous, and you installed TextMate.app without sudo anyway.
Homebrew refuses to work using sudo.
You should only ever sudo a tool you trust. Of course, you can trust Homebrew 😉 But do you trust the multi-megabyte Makefile that Homebrew runs? Developers often understand C++ far better than they understand make syntax. It’s too high a risk to sudo such stuff. It could modify (or upload) any files on your system. And indeed, we’ve seen some build scripts try to modify /usr even when the prefix was specified as something else entirely.
We use the macOS sandbox to stop this but this doesn’t work when run as the root user (which also has read and write access to almost everything on the system).
Did you chown root /Applications/TextMate.app? Probably not. So is it that important to chown root wget?
If you need to run Homebrew in a multi-user environment, consider creating a separate user account especially for use of Homebrew.
Moreover, Homebrew services are built and configured to run with user accounts, if you run them under the root account you risk to have configuration problems as you experienced. Also, as you should already known, running internet facing services, under a root account is a major security risk.