I am trying to load a workflow as a service using launchctl on macOS (Ventura 13.2.1), but I am encountering an error message. The workflow is located at /Users/rohan/Library/Services/open-bluetooth-pane.workflow/Contents/Info.plist.
When I run the command
sudo launchctl load -w /Users/rohan/Library/Services/open-bluetooth-pane.workflow/Contents/Info.plist
I get the error message "Path had bad ownership/permissions" (Load failed: 122). I have checked the permissions of the folders and files involved, but everything seems to be correct.
I set the permission using following
sudo chown -R rohan:staff /Users/rohan/Library/Services/open-bluetooth-pane.workflow
sudo chmod -R 755 /Users/rohan/Library/Services/open-bluetooth-pane.workflow
Trying to create a simple service using automator and configured it to run the applescript which in turns runs the a shell script to open the Bluetooth pane.
Here is the applescript
on run {input, parameters}
do shell script "/Users/rohan/Documents/bluetooth-settings.sh"
return input
end run
here is the shell script
#!/bin/bash
open /System/Library/PreferencePanes/Bluetooth.prefPane
Code inside Info.plist
?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSServices</key>
<array>
<dict>
<key>NSBackgroundColorName</key>
<string>background</string>
<key>NSIconName</key>
<string>NSActionTemplate</string>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>open-bluetooth-pane</string>
</dict>
<key>NSMessage</key>
<string>runWorkflowAsService</string>
</dict>
</array>
</dict>
</plist>
Info.plist
?