3

My Mac has the default installation of PHP 5.5 at /usr/bin/php and I want to remove it the right way because I want to have PHP 7 instead of this. So far no luck on how to uninstall the right way. I can't simply rm -rf /usr/bin/php because there's a lot of other components like php-cli, php-fpm, etc to be removed as well as apache and mysql.

3

In my opinion, the right way is to set your path to prefer your installation of PHP.

  • Apple restricts PHP so you can't delete it without bypassing the system integrity protection
  • Apple will update those files any time it pleases, so you're always needing to re-do whatever steps you take to modify the system
  • If you make a virtual environment like docker or just using correct paths to your installation, those are portable and don't need any sort of extra work.

If you really need to delete those files, you would boot to recovery HD and disable SIP. Then delete all files and associated libraries (with the potential to break Apple tools if you delete something the system actually runs at some point) and then re-enable SIP as desired. I would make a good backup before changing SIP just in case you wish to recover the system after deleting things.

  • thanks for answer that. Is that mean we're going to have multiple version of php on Mac? – Muhaimin May 8 '16 at 1:31

You must log in to answer this question.

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