@@ -63,10 +63,17 @@ ifneq ($(BRIDGED),)
6363 sed -e "s@/opt/socket_vmnet@$(PREFIX)@g" -e "s/en0/$(BRIDGED)/g" launchd/io.github.lima-vm.socket_vmnet.bridged.en0.plist > "$(DESTDIR)/Library/LaunchDaemons/io.github.lima-vm.socket_vmnet.bridged.$(BRIDGED).plist"
6464endif
6565
66+ define load_launchd
67+ # Hint: try `launchctl enable system/$(1)` if the `launchctl bootstrap` command below fails
68+ launchctl bootstrap system "$(DESTDIR ) /Library/LaunchDaemons/$(1 ) .plist"
69+ launchctl enable system/$(1 )
70+ launchctl kickstart -kp system/$(1 )
71+ endef
72+
6673install.launchd : install.launchd.plist
67- launchctl load -w " $( DESTDIR ) /Library/LaunchDaemons/ io.github.lima-vm.socket_vmnet.plist "
74+ $( call load_launchd, io.github.lima-vm.socket_vmnet)
6875ifneq ($(BRIDGED ) ,)
69- launchctl load -w "$(DESTDIR)/Library/LaunchDaemons/ io.github.lima-vm.socket_vmnet.bridged.$(BRIDGED).plist"
76+ $(call load_launchd, io.github.lima-vm.socket_vmnet.bridged.$(BRIDGED))
7077endif
7178
7279install : install.bin install.doc install.launchd
@@ -80,11 +87,15 @@ uninstall.bin:
8087uninstall.doc :
8188 rm -rf " $( DESTDIR) /$( PREFIX) /share/doc/socket_vmnet"
8289
90+ define unload_launchd
91+ launchctl bootout system "$(DESTDIR ) /Library/LaunchDaemons/$(1 ) .plist" || true
92+ endef
93+
8394.PHONY : uninstall.launchd
8495uninstall.launchd :
85- launchctl unload -w " $( DESTDIR ) /Library/LaunchDaemons/ io.github.lima-vm.socket_vmnet.plist "
96+ $( call unload_launchd, io.github.lima-vm.socket_vmnet)
8697ifneq ($(BRIDGED ) ,)
87- launchctl unload -w "$(DESTDIR)/Library/LaunchDaemons/ io.github.lima-vm.socket_vmnet.bridged.$(BRIDGED).plist"
98+ $(call unload_launchd, io.github.lima-vm.socket_vmnet.bridged.$(BRIDGED))
8899endif
89100
90101uninstall.launchd.plist : uninstall.launchd
0 commit comments