41 | | MacPorts can be removed by issuing the following command from within Terminal using the regular `bash` shell (`${prefix}` being the directory onto which you installed MacPorts, `/opt/local` by default): |
42 | | |
43 | | {{{ |
44 | | sudo rm -rf ${prefix} \ |
| 41 | Uninstalling MacPorts can be a drastic step, and depending on the issue you're experiencing, you may not need to do so. If you're unsure, ask on the macports-users mailing list first. |
| 42 | |
| 43 | If you need to uninstall MacPorts, and your port command is functioning, have it uninstall all the installed ports by typing this in the Terminal: |
| 44 | |
| 45 | {{{ |
| 46 | sudo port -f uninstall installed |
| 47 | }}} |
| 48 | |
| 49 | All that will be left in your installation prefix now will be files that were not registered to any port. This includes any configuration files you edited, any databases you created, any files which MacPorts renamed in order to allow a forced installation or upgrade, and the base MacPorts software itself. You may wish to save your configuration files (most are in /opt/local/etc), databases, or any other unique data. |
| 50 | |
| 51 | To remove all traces of MacPorts, type this in the Terminal: |
| 52 | |
| 53 | {{{ |
| 54 | sudo rm -rf /opt/local \ |
57 | | If you use another shell, such as tcsh, you may need to adopt the above to fit the syntax of your shell. |
58 | | |
59 | | Please note that this command removes all software installed using MacPorts as well as MacPorts itself. This includes configuration files for any ports which were installed; if you need to keep them, back them up before the rm (they should be in `/opt/local/etc`). |
60 | | |
61 | | This command does not remove files installed to locations outside the agreed directory tree. Thus ports that write in other places should be removed manually before removing MacPorts altogether. This includes at least `xfig` and `transfig`, but probably other X11 ports as well. |
62 | | |
63 | | {{{ |
64 | | sudo port uninstall xfig |
65 | | sudo port uninstall transfig |
66 | | }}} |
| 67 | Substitute your own MacPorts prefix for /opt/local, if you've installed MacPorts in a different place. |
| 68 | |
| 69 | If you use a shell other than bash (perhaps tcsh), you may need to adjust the above to fit your shell's syntax. |
| 70 | |
| 71 | Note that depending on which version of MacPorts you have and which ports you've installed, not all of the above paths will exist on your system. This is ok. |