Command line option to uninstall NoSleep utility

#!/bin/sh

COMMON_DEFINED=yes

KEXT_ID=com.protech.NoSleep
KEXT_PATH=/System/Library/Extensions/NoSleep.kext
PERF_PATH=/Library/PreferencePanes/NoSleep.prefPane
HELPER_PATH=/Applications/Utilities/NoSleep.app

USER_SUDO_CMD=””

if [ “$SUDO_USER” != “” ]; then
USER_SUDO_CMD=”sudo -u $SUDO_USER”
else if [ “$USER” != “” ]; then
USER_SUDO_CMD=”sudo -u $USER”
fi
fi
#!/bin/sh

echo “Uninstalling 1.3.1”
sudo true

if [ “$COMMON_DEFINED” = “” ]; then
source `dirname “$0″`/Common.sh
fi

if [ -e “$HELPER_PATH” ]; then
echo “Removing NoSleep.app…”
ps aux|grep NoSleep.app|awk ‘{print $2}’|xargs kill &> /dev/null
sudo rm -rf “$HELPER_PATH”
fi

if kextstat | grep “$KEXT_ID” > /dev/null; then
echo “Unloading kernel extension…”
sudo kextunload -b “$KEXT_ID”
fi

if [ -e “$KEXT_PATH” ]; then
echo “Removing kernel extension…”
sudo rm -rf “$KEXT_PATH”
fi

if [ -e “$PERF_PATH” ]; then
echo “Removing preferences plug-in…”
sudo rm -rf “$PERF_PATH”
fi

sudo pkgutil –forget “com.protech.pkg.NoSleep” &> /dev/null

echo “Done”
#!/bin/sh

echo “Uninstalling NoSleepCtrl”
sudo true

CLI_PATH=/usr/local/bin/NoSleepCtrl

if [ -e “$CLI_PATH” ]; then
echo “Removing NoSleepCtrl…”
sudo rm -rf “$CLI_PATH”
fi

sudo pkgutil –forget “com.protech.pkg.NoSleepCtrl” &> /dev/null

echo “Done”

In

4 responses

  1. soo… what do I do with this? Is it a step by step or just cut and paste the whole thing into terminal??
    Thx
    And I appreciate the answer ‘if you don’t know then you probably shouldn’t be using terminal’ but I can’t seem to find an easy fix to remove this extension.

  2. kmdarshan Avatar
    kmdarshan

    Copy this entire statements into a .sh file. and then run it in the command line.
    a. do vi and paste all statements.
    b. save this file to a .sh
    c. run this on the command line/terminal ./…

  3. Hi! Wow this is an old post, hopefully you will still be willing to answer to this comment 🙂 My MacBook had some sort of kernel panic and (being covered by Applecare and having neglected backups) I took it to the Apple repair place to get it repaired.
    Now I’m cleaning it up from some useless/broken files and NoSleep is one of them. Because I’m a bit scared I’ll delete something needed for the system to boot, can you please confirm that if I delete NoSleep.kext and NoSleep.prefPane I’ll be ok?!
    There isn’t a NoSleep app in /Applications/Utilities/ as I’ve probably deleted it at an earlier stage.
    Thank you so much in advance! This is an amazing blog by the way, congrats for the amazing work.

    1. kmdarshan Avatar
      kmdarshan

      It shouldn’t be an issue.

Leave a Reply to Chai Cancel reply

Your email address will not be published. Required fields are marked *