Last active
June 27, 2021 21:41
-
-
Save rafaelfelix/1ee8b98628bfcdd687808a6d181416f1 to your computer and use it in GitHub Desktop.
Uninstall Native Instruments products from Mac OSX (based on https://support.native-instruments.com/hc/en-us/articles/210291865-How-to-Uninstall-Native-Instruments-Software-from-a-Mac-Computer)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import argparse | |
import os | |
import shutil | |
import sys | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser(description="Native Instruments uninstaller util for Mac (see: https://support.native-instruments.com/hc/en-us/articles/210291865-How-to-Uninstall-Native-Instruments-Software-from-a-Mac-Computer)") | |
parser.add_argument("name", type=str, help="Name of the application to be uninstalled (ex: Session Horns)") | |
parser.add_argument("-f", "--force", action="store_true", help="do not ask for confirmation ") | |
args = parser.parse_args() | |
paths_to_search = { | |
# Application Files | |
os.path.join(os.sep, "Applications", "Native Instruments"): args.name, | |
os.path.join(os.sep, "Library", "Preferences"): "com.native-instruments.%s.plist" % args.name, | |
# Plug-in Files | |
os.path.join(os.sep, "Library", "Audio", "Plug-ins", "Components"): "%s.component" % args.name, | |
os.path.join(os.sep, "Library", "Audio", "Plug-ins", "VST"): "%s.vst" % args.name, | |
os.path.join(os.sep, "Library", "Application Support", "Digidesign", "Plug-ins"): "%s.dpm" % args.name, | |
os.path.join(os.sep, "Library", "Application Support", "Avid", "Audio", "Plug-ins"): "%s.aaxplugin" % args.name, | |
# App-specific Data and Support Files | |
os.path.join(os.sep, "Library", "Application Support", "Native Instruments"): args.name, | |
os.path.join(os.sep, "Library", "Application Support", "Native Instruments", "Service Center"): "%s.xml" % args.name, | |
# Preferences Files (User Library) | |
os.path.join(os.path.expanduser("~"), "Library", "Preferences"): "com.native-instruments.%s.plist" % args.name, | |
os.path.join(os.path.expanduser("~"), "Library", "Application Support", "Native Instruments"): args.name, | |
# Content Files | |
os.path.join(os.sep, "Users", "Shared"): "%s Library" % args.name | |
} | |
paths_found = [] | |
for path, search in paths_to_search.items(): | |
files = [x.lower() for x in os.listdir(path)] | |
if search.lower() in files: | |
paths_found.append(os.path.join(path, search)) | |
if len(paths_found) == 0: | |
print("%s wasn't found in any path known by the uninstaller." % args.name, file=sys.stderr) | |
sys.exit(1) | |
print("Found references to %s in the following paths: \n" % args.name) | |
for p in paths_found: | |
print("- %s" % p) | |
if not args.force: | |
read_input = None | |
if sys.version_info.major < 3: | |
read_input = raw_input | |
else: | |
read_input = input | |
assert callable(read_input) | |
print("\nWARNING: make sure %s is not open (when in doubt, close any DAW you may have running or Kontakt instances" % args.name) | |
print("\nAre you sure you want to completely remove them? [y/N]") | |
while True: | |
choice = read_input().lower() | |
if choice in ("y", "Y", "yes", "YES"): | |
break | |
elif choice in ("n", "N", "no", "NO"): | |
print("Uninstalling %s cancelled" % args.name, file=sys.stderr) | |
sys.exit(1) | |
else: | |
print("Please respond with 'yes' or 'no'") | |
for p in paths_found: | |
if os.path.isdir(p): | |
shutil.rmtree(p) | |
else: | |
os.remove(p) | |
print("Removed: %s" % p) | |
print("%s uninstalled successfuly" % args.name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use this script, just download it,
chmod +x ni-installer.py
and run it with sudo