问题
Brew services has installed this plist file for mysql.
~ $ brew services list
Name Status User Plist
mysql56 started mh /Users/mh/Library/LaunchAgents/homebrew.mxcl.mysql56.plist
Is this file safe to edit (i.e. will brew ever overwrite changes made here)? Is there another method I should use to modify the file?
回答1:
All .plist
files that come with Formulas can be found in Cellar dir. For instance homebrew.mxcl.mysql.plist
is in /usr/local/Cellar/mysql/5.7.14
. You can modify it and brew services
will use it.
Alternatively you can modify /Library/LaunchDaemons/homebrew.mxcl.mysql.plist
and make it immutable with sudo chflags uchg /Library/LaunchDaemons/homebrew.mxcl.mysql.plist
. This won't allow brew
to rewrite or modify .plist
file.
回答2:
I (unfortunately) don't know which file you can edit, but I can confirm that editing anything in the Library/LaunchAgents
directory will be overwritten by brew services
on the next start, so editing it directly isn't going to help.
回答3:
- Copy
/Users/mh/Library/LaunchAgents/homebrew.mxcl.mysql56.plist
somewhere - make changes to copy of plist
- run
brew services start mysql56 {path to modified copy of plist file}
回答4:
When you install a package with Homebrew formula
a .plist file is placed in the package folder
(usually /usr/local/Cellar/... folder)
in OSX this file is copyed/deleted to/from the
/Library/LaunchDaemons/
folder every time tou start/stop the service with Homebrew:
brew services start <the-app>
brew services stop <the-app>
Better then 'blocking' this file
is acting over the file in your package folder...
this example is for OSX/Mojave & MariaDB:
suppose you want to change the default data folder
and the TCP port from 3306 to 3308
edit the
/usr/local/Cellar/mariadb/10.4.6_1/homebrew.mxcl.mariadb.plist
locate this section in the XML
make you desired changes (choose you desired folder):
...
<string>/usr/local/opt/mariadb/bin/mysqld_safe</string>
<string>--datadir=/DAT/mariadb</string>
<string>--port=3308</string>
...
then just stop and restart the service with Homebrew
et voilá... you can use netsat to confirm:
netstat|grep 3308
来源:https://stackoverflow.com/questions/36089384/brew-services-where-to-edit-configuration