update request: launchctl command usage has changed in recent macOS versions
#6,362 创建于 2021年8月13日
仓库指标
- Star
- (30,937 star)
- PR 合并指标
- (平均合并 7天 5小时) (30 天内合并 321 个 PR)
描述
launchctl usage has changed in some macOS update (I'm not sure which one, either Big Sur or Catalina I think) and the old commands mostly don't work now.
Here are some examples of what does work now:
launchctl kickstart gui/501/local.phoenix.rsync-backup-prompt.plist
launchctl enable gui/501/local.phoenix.asimov-on-mount
launchctl blame gui/501/local.phoenix.rsync-backup-prompt
While these do not work anymore:
launchctl load -w ~/Library/LaunchDaemons/local.phoenix.asimov-on-mount.plist
launchctl start ~/Library/LaunchDaemons/local.phoenix.asimov-on-mount.plist
I think some commands are new (kickstart was new to me, at least). The biggest difference though is that you must provide this new kind of identifier instead of a path to the plist file.
Here's some up-to-date man pages: https://ss64.com/osx/launchctl.html
Here is the same man page at the most recent state before that change (in 2016): https://web.archive.org/web/20160413011425/http://ss64.com/osx/launchctl.html
The first part of the identifier must be one of the ones listed on that man page (gui, user, etc).
The "uid" in some of those identifiers is the user'd ID number, which can be discovered with id -u (the default for a single-user computer is 501). I'm not sure about how to find the other IDs for other types of identifiers.
According to that page, the new syntax was introduced in Yosemite. Not sure the details of when the old syntax stopped working.