Skip to content

Instantly share code, notes, and snippets.

@mithun
Created June 4, 2021 20:01
Show Gist options
  • Save mithun/7d221aebe17f66cfa8f34c866e6a5b45 to your computer and use it in GitHub Desktop.
Save mithun/7d221aebe17f66cfa8f34c866e6a5b45 to your computer and use it in GitHub Desktop.

Revisions

  1. mithun created this gist Jun 4, 2021.
    28 changes: 28 additions & 0 deletions uninstall-python3.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    #!/usr/bin/env bash

    # This script will uninstall all the versions of Python 3.x
    # on your Mac OS/X system - It is designed to function as a dry run
    # so you can see all that it will do. To run a dry run, do
    #
    # bash uninstall-python3.sh
    #
    # Examine the output - make sure that it is moving only the expected
    # files. When you are convinced this will do what you expect run
    #
    # bash uninstall-python3.sh | sudo bash -v
    #
    # To verify the files are gone, you can re-run
    #
    # bash uninstall-python3.sh
    #
    # It should produce no output.
    #
    # And then you can happily re-install Python 3
    #
    # Written by: Charles R. Severance (@drchuck)
    # https://github.com/csev/uninstall-python3
    # License: Public Domain / MIT - Use any way you like

    ls -l /usr/local/bin | grep /Library/Frameworks/Python.framework/Versions/3 | awk '{print "rm \47/usr/local/bin/" $9 "\47"}'
    ls -d /Library/Frameworks/Python.framework/Versions/3.* 2>/dev/null | awk '{print "rm -rf \47" $0 "\47"}'
    ls -d /Applications/Python\ 3.* 2>/dev/null | awk '{print "rm -rf \47" $0 "\47"}'