Lots of Mac users never install software from anywhere other than the Mac App Store. Others install from the Mac App Store and download apps from individual developers or use third-party app stores. However, there are a few Mac users, including those who have switched from Windows or Linux, who are particularly adventurous and want to use tools that aren’t available as complete install packages that can be easily downloaded from their developer. Most of these tools are open source and hosted in repositories like GitHub. And to install those, you often need to use Terminal. In many cases, you’ll also need to use a package manager like Homebrew or, as we’re discussing in this article, MacPorts. In this article, we’ll show you how to uninstall MacPorts if you’ve installed it and no longer need it.
What is MacPorts
MacPorts is a package manager like Homebrew. It’s used to install applications and utilities using Terminal. Specifically, MacPorts is a package manager for tools ported from Linux that is hosted in a repository, including NEdit, gv, GMT, and Ghostscript. Although you can install MacPorts directly from the source using Terminal, there is also a .pkg installer file available that allows you to install it by running the installer.
Why uninstall MacPorts?
The main reason for uninstalling MacPorts is that you installed it to try it out or to run some ported software but no longer need it. As with all applications and utilities on your Mac, if you no longer need it, you should remove it to free up space and prevent possible conflicts with other applications you install in the future.
How to uninstall MacPorts the easy way
As we’ll see when we show you the manual method for uninstalling MacPorts, normally, the process of uninstallation is time-consuming and involves quite a lot of effort running Terminal commands and tracking down files it has placed on your Mac. The easy method, however, means just a couple of clicks. It uses the Uninstaller tool in CleanMyMac, which racks down all those files for you and allows you to remove them easily. You can download CleanMyMac for free here and try it for yourself. Just follow these steps to remove MacPorts:
- Open CleanMyMac and choose Applications in the sidebar.
- Click Scan > Manage My Applications > Uninstaller.
- Locate MacPorts in the list of all apps and select it.
- If there is an application called Darwin, select that, too.
- Click the Uninstall button.
How to uninstall MacPorts manually
If you’d rather uninstall MacPorts manually, here’s how to do it:
- Open Terminal from Applications > Utilities.
- Type this command and then press Return:
sudo port -fp uninstall installed
- If that returns an error message or it seems it didn’t work, go to step 4 to remove the files using Finder.
- Click on the Go menu and choose Go to Folder, then paste this file path:
/opt/local/bin/port
. Drag the port folder to the Trash. - When you installed MacPorts, it created a MacPorts user and group on your Mac, so the next step is to remove those. Use these commands in Terminal, pressing Return after each one:
$ sudo dscl . -delete /Users/macports
$ sudo dscl . -delete /Groups/macports
- If any of the ports you installed while using MacPorts created their own users or groups, use the same commands to remove those but replace ‘MacPorts’ in the commands with the names of the users and groups created.
- To remove the rest of the files installed by MacPorts, type bash in Terminal and press Return. Now, use the following script:
$ sudo bash -c rm -rf \
/opt/local \
/Applications/DarwinPorts \
/Applications/MacPorts \
/Library/LaunchDaemons/org.macports.* \
/Library/Receipts/DarwinPorts*.pkg \
/Library/Receipts/MacPorts*.pkg \
/Library/StartupItems/DarwinPortsStartup \
/Library/Tcl/darwinports1.0 \
/Library/Tcl/macports1.0 \
~/.macports
Alternatively, you could use the Go to Folder command in Finder to navigate to each of the directories and remove all files and folders named MacPorts or Darwin. The file paths are:
- /Applications/DarwinPorts
- /Library/LaunchDaemons/org.MacPorts.*
- /Library/Receipts/DarwinPorts*.pkg
- /Library/Receipts/MacPorts*.pkg
- /Library/StartupItems/DarwinPortsStartup
- /Library/Tcl/darwinports1.0 \
- /Library/Tcl/MacPorts1.0 \
You will also need to go to your Applications folder and drag MacPorts and Darwin to the Trash.
How to reset MacPorts if it’s misbehaving
If MacPorts or any other application on your Mac is not working as it should and you want to keep using it, there is something you can try before uninstalling and reinstalling it — resetting the app. Resetting an application means leaving the application itself on your Mac but removing settings files and other files it has placed on your Mac so when you next launch it, it’s in the state it was in when you first installed it. You can reset any app using CleanMyMac:
- Open CleanMyMac and, once again, run a scan in the Applications tool.
- Click Manage My Applications > Uninstaller.
- Select MacPorts on the list.
- Click the arrow (>) next to its name.
- Select everything except Binaries and click Remove.
MacPorts is a useful tool if you want to run Linux ports on your Mac. However, if you have installed it and no longer use it, you should follow the steps above to uninstall MacPorts.