MacOS – Is it possible to remove all installed terminal applications and extensions back to native without doing a clean OSX install

apachemacosPHPterminal

Basically I would like to know if it is possible to remove all php, apache, homebrew, mac ports etc. installs back to native without doing a clean install of the OS?

If not is the best way to go about having a mac in this state to do a clean install and then revert some of the folders back using time machine i.e. the applications folders, documents etc?

Best Answer

Firstly, you should be sure why you would like to do this and what a fresh environment would provide. This is going to be a bit tedious to do since you have multiple sources for the installs.

  • For homebrew, follow the steps in this answer to uninstall homebrew.
  • For MacPorts, follow the steps from the uninstall MacPorts page page.
  • For PHP and Apache, it may not be simple to revert them to what the OS came with if you installed these outside of solutions like homebrew, MacPorts, MAMP or XAMPP.

The non-tedious way, which may take longer to complete, is to

  • Clone your drive (using a tool like Carbon Copy Cloner or SuperDuper! or Clonezilla).
  • Reinstall the OS afresh.
  • Then use Migration Assistant to bring everything over from the clone. You would have to uncheck the "Other files and folders on ..." option in Migration Assistant to prevent it from bringing back the locations that homebrew, MacPorts, etc., use. This method would also skip many files (like in /Users/Shared) that you would have to copy over manually from the backup.