Creé el plist y lo coloqué en /System/Library/LaunchAgents/. Sin embargo, cuando reinicio mi Mac, no se carga como se esperaba. Puedo cargarlo desde la Terminal con comandos launchctl load
y unload
y está perfectamente cargado desde allí. Y también revisé la consola después de reiniciar y no tiene ninguna entrada relacionada con el plist.
¿Cómo puedo hacer que este plist se ejecute en el arranque?
¿La lista de propiedades es propiedad de root? Si no es así, no se carga al iniciar sesión incluso si launchctl load
(sin sudo) lo cargaría.
$ sudo launchctl load /Library/LaunchAgents/test.plist
launchctl: Dubious ownership on file (skipping): /Library/LaunchAgents/test.plist
nothing found to load
$ sudo chown root /Library/LaunchAgents/test.plist
$ sudo launchctl load /Library/LaunchAgents/test.plist
$
Si el programa debe ejecutarse cuando se carga la lista de propiedades, establezca RunAtLoad en verdadero:
<key>RunAtLoad</key>
<true/>
También puede usar normalmente /Library/LaunchAgents/ en lugar de /System/Library/LaunchAgents/. de man launchd
:
~/Library/LaunchAgents Per-user agents provided by the user.
/Library/LaunchAgents Per-user agents provided by the administrator.
/Library/LaunchDaemons System-wide daemons provided by the administrator.
/System/Library/LaunchAgents Per-user agents provided by Mac OS X.
/System/Library/LaunchDaemons System-wide daemons provided by Mac OS X.
mmmmmm
tiene muchas preguntas estúpidas
chmod 600
(ochmod 644
) ychown root
.