I'm new to the mac, and apparently I've made some sort of error. I've been learning python, via tutorials, and between Homebrew, Pip and XCode somehow my versions are all mixed. Pip3 points to python2, so all my python3 trials fail, etc...

I'm researching how to safely remove all versions and then shoot for a clean install (homebrew?) but I'm a bit nervous.

I've found some excellent links:

Clearly one doesn't touch anything in the root /system directory, and basically everything else gets deleted. What makes me nervous, is that this links are pretty doggone old. (six years! +) I'm not sure if I really trust them or not.

Anybody been here lately? Can I trust the postings linked above? How do I clean up this python version mess? Note: I'm using MacOS Sierra (10.12.5)


So, I ended up removing all python installations, and reinstalling things via Homebrew.

  1. which python ---> /Library/Frameworks/Python.framework/Versions/2.7/bin/python Delete the entire Python.framework directory from /Library/Frameworks.
  2. which python3 ---> /usr/local/bin/python3 Delete the entire python3 directory.
  3. I was a bit nervous about the symlinks. I initially renamed the ones that were obviously going to cause me trouble. It turns out that was unnecessary. Instead, just use:

    $ brew doctor
    Warning: Broken symlinks were found. Remove them with 'brew prune':

    So, brew prune (or brew cleanup --prune in newer versions of Homebrew) worked perfectly. It removed all of the above symlinks.

  4. Reinstall python and python3 via homebrew. All done.

At no time did I touch the python installation located within the /System folder.

Oh, and to be clear. The answer to the original question is

Yes, you can trust the old references, as written! That guidance is still valid.

  • @nohillside thx but.. you could have easily acknowledged the recent input from XXXX here that prompted your edit as a comment here. Seems an odd attribution miss for you.. Are newby's not allowed to post comments? And now I can't see the submit name to do it myself. – zipzit Feb 26 '19 at 7:13
  • The best way to get attribution is to actually edit a post in case editing is required, something all users (even anonymous ones) can do. If users choose to post improvement comments as answers I usually just edit them into the related post. – nohillside Feb 26 '19 at 10:25
  • Homebrew versions of python will not include support for Xcode or tooling like chisel the last I checked. So this is typically not recommended. – nyteshade Jun 7 '19 at 0:08
  • Just to mention /System/Library/Frameworks/Python.framework/ must not never be removed, link docs.python.org/3/using/mac.html – Ivan Proskuryakov Jun 29 '19 at 16:00
  • new version has brew cleanup – GraphicalDot Jul 30 '19 at 12:09

My Python version was 3.6, I wanted to upgrade to 3.7 (In case you have similar requirements). I am using macOS version 10.12.6 and simply uninstalling and re-installing worked for me:

brew uninstall --ignore-dependencies python3


brew install python3

and done:

Python 3.7.2 (default, Jan 13 2019, 12:51:54) 
[Clang 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
  • This worked well for me. I did need to adjust the ipython path by manually editing the launch script - to point to the brew version of python – StephenBoesch Mar 27 '19 at 18:53

System files are protected by System Integrity Protection. You won't be able to follow these instructions to rm -rf random folders in /System without disabling SIP first.

However, because the files are protected, you know the files haven't been modified. Your ‘version mess’ would be due to your shell setup and wouldn't be changed by modifying system files anyway. You shouldn't be touching these files which are guaranteed to exist in macOS.

Homebrew installs separately in /usr/local/Cellar. Use Homebrew to manage your Python installation and ignore the system installation completely.

  • Was that YES, okay to trust those two references, or NO, don't trust them? Those references seem of high quality, well reasoned, and explained in pretty good detail. – zipzit May 25 '17 at 19:02
  • 1
    @zipzit You can trust them, but they won't work — that's two separate things. The content is trustworthy; try it on a recent version of macOS and it won't do any harm, but it also won't work, for the reasons given in this answer. I highly recommend not disabling SIP just to remove your system Python installation (which is why I haven't linked to instructions) because that's not the actual cause of your problem and won't help solve anything, potentially causing more problems in the process. – grg May 25 '17 at 19:04
  • Your answer doesn't make sense to me. None of the quality answers linked above touches anything in /system. None = Not One, Zero, Zip, Nada. There are things to delete in 1) Python 3.3 folder in your Applications folder. 2) /Library/Frameworks/Python.framework 3) ~ 20 symlinks in /usr/local/bin. 4) references in shell path (if exists). I wouldn't think any of those will hit the protections you are talking about. What am I missing? – zipzit May 25 '17 at 19:11
  • @zipzit Quite a while ago, Python was moved from /Library to /System/Library, so you will be touching /System in an attempt to remove the system installation. The system Python framework is in /System/Library/Frameworks/Python.framework, not /Library. – grg May 25 '17 at 21:28
  • $which python /Library/Frameworks/Python.framework/Versions/2.7/bin/python $ which python3 /usr/local/bin/python3 plus python 2.3, 2.4, 2.5, 2.7 and current located at System/Library/Frameworks/Python.framework/Versions/... – zipzit May 25 '17 at 22:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .