How to re-install ports without removing downloaded source and builds?
Ryan Carsten Schmidt
ryandesign at macports.org
Mon Jul 7 22:49:56 UTC 2025
On Jul 7, 2025, at 08:14, Nick wrote:
>
>
> Does anyone know how to do this? I want to `rm -r` my installation directory and start the installation over, but not download and compile everything again. I think I'd lose my database if I do that and if I do `port uninstall installed`, I lose the builds as it does a `port clean name`.
If you want to uninstall MacPorts, follow the instructions in the guide; don't just "rm -rf" the directory.
If your installation directory is /opt/local you'll get binaries of most ports you install and won't have to build them from source. If you use a different directory or have installed MacPorts from source and changed some configuration parameters, then all ports get built from source. Replace "/opt/local" with your actual directory in my remarks below.
If you want to save distfiles, move /opt/local/var/macports/distfiles out before deleting /opt/local and move it back after reinstalling MacPorts.
If you want to preserve in-progress builds, do the same for /opt/local/var/macports/build
If you want to preserve log files for in-progress builds, do the same for /opt/local/var/macports/logs
I'm not sure what you meant by "my database". If you mean the MacPorts SQLite database known as the registry that keeps track of what ports are installed, yes, deleting /opt/local will delete that which is what you would want if you're uninstalling MacPorts. If you mean some other database like PostgreSQL or MariaDB, yes, by default those are stored in /opt/local and would be deleted unless you preserve them. It's also a good idea to make backups of any important databases as an SQL dump.
Because of the time and bandwidth needed to reinstall ports, and even more time needed if compiling them, and the wear and tear on your disk, reinstalling MacPorts may not be the best solution to your problem. If you let us know what the problem is—why you think reinstalling MacPorts is needed—we might find a different solution.
More information about the macports-users
mailing list