# Reinstalling all ports



## nanotek (Feb 3, 2014)

Why is this method described in portmaster(8)?


```
Using portmaster to do a complete reinstallation of all your ports:
           1. portmaster --list-origins > ~/installed-port-list
           2. Update your ports tree
           3. portmaster -ty --clean-distfiles
           4. portmaster --check-port-dbdir
           5. portmaster -Faf
           6. pkg_delete -a
           7. rm -rf /usr/local/lib/compat/pkg
           8. Back up any files in /usr/local you wish to save,
              such as configuration files in /usr/local/etc
           9. Manually check /usr/local and /var/db/pkg
              to make sure that they are really empty
           10. Re-install portmaster
           11. portmaster `cat ~/installed-port-list`

     You probably want to use the -D option for the installation and then run
     --clean-distfiles [-y] again when you are done.  You might also want to
     consider using the --force-config option when installing the new ports.

     Alternatively you could use portmaster -a -f -D to do an ``in place''
     update of your ports.  If that process is interrupted for any reason you
     can use portmaster -a -f -D -R to avoid rebuilding ports already rebuilt
     on previous runs.  However the first method (delete everything and rein-
     stall) is preferred.
```

Can `portmaster -f` equally be used?

Also, what's the point in performing 5 before 6? Seems counterintuitive to me. Why rebuild all those packages (`portmaster -Faf`) only to delete them (`pkg_delete -a`)?

*ETA:* Never mind about the question immediately above; I misread portmaster(8). Apparently `portmaster -Faf` only fetches distfiles. 

ETA: Also, considering pkg_ is deprecated -- what's the up-to-date method (PKGNG)? That really should be in the official documentation.


----------



## nanotek (Feb 3, 2014)

What is this:


```
# portmaster -ty --clean-distfiles
===>>> Package installation support cannot be used with pkgng yet,
       it will be disabled

===>>> Gathering distinfo list for all ports
       (This will take several minutes)

make: "/usr/ports/devel/lua50-filename/Makefile" line 12: Cannot open /usr/ports/devel/lua50-filename/../lua-filename/Makefile
make: Fatal errors encountered -- cannot continue
```


----------

