How to prevent nginx from auto-loading using homebrew

homebrewservicesstartupterminal

I'm using Mac High Sierra. I install nginx with homebrw a while back, but I can't remember how to permanently stop it from running when my computer boots. I have this file

localhost:mydir davea$ ls /Library/LaunchDaemons/*nginx*
/Library/LaunchDaemons/homebrew.mxcl.nginx.plist

but even though "sudo brew services stop nginx", stops it, I don't want to have to keep running that every time I restart my machine.

Best Answer

The ‘stop’ verb to ‘brew services’ will stop the service from restarting automatically on boot having ‘unregistered it from launching at login (or boot)’ per the help text shown with ‘brew services’. The file you mention should be removed when you ‘stop’ the service.

You can check whether Homebrew believes the service is running or should run on startup with the ‘list’ verb.

$ brew services list
Name    Status  User Plist
nginx   started root /Library/LaunchDaemons/homebrew.mxcl.nginx.plist

$ ls /Library/LaunchDaemons/*nginx*
/Library/LaunchDaemons/homebrew.mxcl.nginx.plist

$ sudo brew services stop nginx
Stopping `nginx`... (might take a while)
==> Successfully stopped `nginx` (label: homebrew.mxcl.nginx)

$ brew services list
Name    Status  User Plist
nginx   stopped      

$ ls /Library/LaunchDaemons/*nginx*
zsh: no matches found: /Library/LaunchDaemons/*nginx*