tags:

views:

336

answers:

2

Suppose I want to reset a port to its initial state, including its configuration files. This can be achieved by:

sudo port uninstall portname
sudo port install portname

(Deactivating and then reactivating the port does not reset the configuration files.)

Is there any way to do this without uninstalling and reinstalling the port, avoiding the overhead of having to rebuild the package?

Edit: Thanks for the replies, Alexander and Nerdling. Archive mode worked for me.

+1  A: 

I had the exact same question a few weeks ago. I searched through the Macports documentation without any luck. As far as I know, it doesn't have a command to do that.

Alexander
+4  A: 

What you want to do is activate archive mode.

vi ${prefix}/etc/macports/macports.conf

Typically, your prefix is /opt/local.

Inside that file, look for portarchivemode and enable it. Now, whenever you install a package, the files will be archived as whatever portarchivetype is set to.

Supported types: tgz (default), tar, tbz, tbz2, tlz, xar, zip, cpgz, cpio

If you uninstall a port, it will open the archive rather than rebuilding everything.

Nerdling