请考虑以下命令
# launchctl stop
Usage: launchctl stop <service-name>
# launchctl stop com.apple.SomeService
# launchctl disable com.apple.SomeService
Usage: launchctl disable <service-target>
服务目标和服务名称之间有什么区别?如何从服务名称中学习服务的服务目标?
请考虑以下命令
# launchctl stop
Usage: launchctl stop <service-name>
# launchctl stop com.apple.SomeService
# launchctl disable com.apple.SomeService
Usage: launchctl disable <service-target>
服务目标和服务名称之间有什么区别?如何从服务名称中学习服务的服务目标?
Answers:
服务目标是服务名称加上目标域,它描述服务运行的上下文,例如它是在系统启动时运行还是在特定用户登录时运行。
launchctl(1)联机帮助页描述了从服务名称形成服务目标的6种方法。如果要禁用在启动时运行的服务,您可能需要这三个中的一个,具体取决于它是在系统启动时运行还是在您登录时运行的服务:
system/[service-name]
Targets the system domain or a service within the system domain. The system
domain manages the root Mach bootstrap and is considered a privileged execu-
tion context. Anyone may read or query the system domain, but root privi-
leges are required to make modifications.
user/<uid>/[service-name]
Targets the user domain for the given UID or a service within that domain. A
user domain may exist independently of a logged-in user. User domains do not
exist on iOS.
gui/<uid>/[service-name]
Another form of the login specifier. Rather than specifying a user-login
domain by its ASID, this specifier targets the domain based on which user it
is associated with and is generally more convenient.
您可以找到您的用户帐户的uid号码,如下所示:
$ id -u [your-username]
502
launchchtl list
到“服务目标”而不尝试所有这些可能的域?