This script was written by Gonzalo on first version of the forum all credits goes to him.
Hi,
I got this working for Kodi on OS X Yosemit (should work on other versions too). I used the Linux script (Thanks to Henk) but had to do a couple of little tweaks to it, here are the steps to install it so it automatically runs when the computer starts:
# Create the following 2 files in your user folder (note, my user is “media”, replace that everywhere with your user:
/Users/media/yatse.kodi.autostarter.sh
#!/bin/bash
UDP_PORT=9 # Change this if you need to run this on a different port, just remember to update Yatse's settings as well
RUN_XBMC_AS=media # Change this if you need to run it as another user
START_PHRASE="YatseStart-Xbmc" # Do not touch this, unless you know what you are doing…
# The following block checks if the user running this script has the required privileges to listen on the port specified above
WHO=`whoami`
if [ "$WHO" != "root" ]
then
echo "Unprivileged users may not evesdrop on ports. Cannot start unless running as root."
exit 1
fi
echo "Listening on port $UDP_PORT for Yatse remote start command"
while [ true ]; do
# Wait for a packet to come in from Yatse
LISTEN=`tcpdump -A -c 2 "udp port $UDP_PORT" 2>&1 | grep -o "$START_PHRASE"`
# Make sure that we received the right command
if [ "$LISTEN" = "$START_PHRASE" ]; then
echo "Starting XBMC as $RUN_XBMC_AS"
# Start XBMC using sudo -u to run it using the username above
# If you need to you can replace the xbmc command below with xbmc-standalone if you are not using a window manager
sudo -u $RUN_XBMC_AS /Applications/Kodi.app/Contents/MacOS/Kodi
fi
# Sleep, to be nice, for unwanted rogue processes writing to our port
sleep 1
done
/Users/media/com.yatse.kodi.autostarter.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>Label</key>
<string>com.yatse.kodi.autostart.plist</string>
<key>ProgramArguments</key>
<array>
<string>/Users/media/yatse.kodi.autostarter.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
# Execute the following commands on a Terminal to Fix ownership / permissions and move the plist to the right place:
# The plist file needs to be owned by root
sudo chown root:wheel /Users/media/com.yatse.kodi.autostarter.plist
# This will move it to the right place so the script runs as root when the system starts
sudo mv /Users/media/com.yatse.kodi.autostarter.plist /Library/LaunchDaemons
# This sets the proper permissions so the files are owned and can be executed by root
sudo chown root:wheel /Users/media/yatse.kodi.autostarter.sh
sudo chmod 755 /Users/media/yatse.kodi.autostarter.sh
- Restart your system
Cheers,
G