LaunchAgent for gitwatch under MacOS
Max Rossmannek edited this page Apr 27, 2020
·
1 revision
Under MacOS, systemctl
is not available. However, launchctl
provides a similar set of features and can be used to achieve startup automation of custom scripts.
As working LaunchAgent configuration file was developed in this snippet. For simplicity, it is repeated here:
<?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>Label</key>
<string>com.github.gitwatch</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/gitwatch</string>
<string>*INSERT ARGUMENTS HERE*</string>
</array>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
</dict>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
The file above is based on the following assumptions:
-
gitwatch
has been installed under/usr/local/bin
-
fswatch
is installed in any of the directories included inPATH
- Copy the contents of the above snippet into a file.
- Insert the command line arguments for gitwatch as desired.
- Save the file under
~/Library/LaunchAgent/com.github.gitwatch.plist
. Note: you may change the filename, but if you do, ensure to update theLabel
in the file accordingly! - Start the agent by logging out and in again or via
launchctl load ~/Library/LaunchAgent/com.github.gitwatch.plist