I tried following the excellent instructions on this gist to upgrade my Mac to PHP 5.4, but before I do, I need to know:

Is there an easy way to find out which php extensions do I have installed currently? I'd like to have the same list for 5.4. I tried port list | grep php53- but got way too many responses...

2 Answers 2


To show installed php extensions from port, try port installed | grep php53- or instead of port list.

  • Already tried that (read the question) - too many... Commented Jan 5, 2013 at 1:33
  • How many did you get from port installed | grep php53- ? The mac port current has 98 php53- from port list | grep -c php53-. If you have 98 from port installed | grep -c php53-, you have installed all extension for php53.
    – neo
    Commented Jan 5, 2013 at 2:04
  • Actually, I tried again with SUDO and your method yielded 0. I then switched to port installed | grep php5 and now I have 8 - so it seems your idea works. Thanks!!! Commented Jan 5, 2013 at 2:44

port list shows all the ports in Macports thus giving you the large list.

To show all the ports you have requested try port list requested. This will only show the ports that you explicitly installed, the ones that they depend on are not shown and were installed by dependency resolution. SO this list will be the smalles list you need to reinstall the same ports. If you grep to fins php then this should give the minimum set of ports. The only issue is if there are any ports you have that depend on a php53- port but do not have php53 in the name but then I suspect there are other issues.

Another way is to to uninstall php53 by sudo port uninstall php53. This will fail giving the list of ports that depend on it which you have to then uninstall. However this could take a few runs to do if a port depends only indirectly on php53.

You must log in to answer this question.

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