#!/bin/sh echo "=== REMOVE DRIVER: BEGIN ===" SILABS_DEST_DIR="/System/Library/Extensions/" driver="${SILABS_DEST_DIR}ANTSiLabsUSBDriver.kext" driver64="${SILABS_DEST_DIR}ANTSiLabsUSBDriver64.kext" for installeddriver in "$driver" "$driver64"; do if test ! -d "$installeddriver"; then echo "Driver $installeddriver not found." continue fi if kextunload "$installeddriver"; then echo "Driver $installeddriver successfully unloaded." else echo "Driver $installeddriver could not be unloaded." fi rm -rf "$installeddriver" done # make kextd recognize the driver echo "Updating kext info." /usr/bin/touch "$SILABS_DEST_DIR" # sending kextd SIGHUP will make it reload the driver KEXTD_PID=`ps -ax | grep -i kextd | grep -v grep | awk '{print $1}'` if test ! -z $KEXTDPID; then echo "Sending kextd SIGHUP" /bin/kill -1 $KEXTD_PID fi echo "=== REMOVE DRIVER: END ===" echo "=== REMOVE FITBITD: BEGIN ===" PLIST_DEST_DIR="/Library/LaunchDaemons/" plist="${PLIST_DEST_DIR}com.fitbit.fitbitd.plist" # It's essential to unload and disable launchd from loading it again. launchctl unload -w "$plist" rm -rf "$plist" rm -rf "usr/local/bin/fitbitd" rm -rf "usr/local/bin/fitbitd.dSYM" echo "=== REMOVE FITBITD: END ===" echo "=== REMOVE APPLICATION: BEGIN ===" rm -rf /Applications/Fitbit.app echo "=== REMOVE APPLICATION: END ===" exit 0