Skip to content

Instantly share code, notes, and snippets.

@MuntashirAkon
Created November 29, 2017 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MuntashirAkon/fd6d2174f52f85635bb2125a3cfa765b to your computer and use it in GitHub Desktop.
Save MuntashirAkon/fd6d2174f52f85635bb2125a3cfa765b to your computer and use it in GitHub Desktop.
DisableSpindump
#!/bin/bash
#
# disablespindump
# Script to disable spindump
#
# (c) Muntashir Al-Islam
# License: MIT License
#
#
# Alert if not a root user
#
if ! [ `id -u` -eq 0 ]; then
echo "The script must be run as root!"
exit 1
fi
spindump_file="/System/Library/LaunchDaemons/com.apple.spindump.plist"
#
# Main
#
if [ -e $spindump_file ]; then
status=`sudo launchctl list | grep com.apple.spindump`
status=$?
if [ $# -eq 1 ] && [ $1 = "false" ]; then
if [ $status -eq 0 ]; then
echo "spindump has already enabled."
exit 1
else
`sudo launchctl load -w $spindump_file`
if [ $? -eq 0 ]; then
echo "spindump is now enabled."
exit 0
else
echo "Cannot enable spindump, try again."
exit 1
fi
fi
else
if [ $status -eq 1 ]; then
echo "spindump has already disabled. Use 'false' argument to enable it."
exit 1
else
`sudo launchctl unload -w $spindump_file`
if [ $? -eq 0 ]; then
echo "spindump is now disabled."
exit 0
else
echo "Cannot disable spindump, try again."
exit 1
fi
fi
fi
else
echo "spindump is already disabled or not available"
exit 1
fi
@MuntashirAkon
Copy link
Author

DisableSpindump

A script to prevent spindump from loading at startup.

Installation

  • Download disablespindump and copy it to /usr/bin
sudo curl -L https://gist.github.com/MuntashirAkon/fd6d2174f52f85635bb2125a3cfa765b/raw/9cb8eec597ea4ecdd1efe90cda951318e82b289c/disablespindump.sh -o /usr/bin/disablespindump
  • Make the file executable
sudo chmod +x /usr/bin/disablespindump

Usage

Always run disablespindump using sudo. The default behavior is to disable spindump.

To enable spindump, run sudo disablespindump false.

License

MIT License

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment