# Best way to keep my system up to date with the latest ports



## churchi (Sep 25, 2010)

Hi all,

I hope this is in the correct section. I have had quite a number of issues over the past day with upgrading my box that i hadn't upgraded for around 6 months. I was wondering what is the easiest way to keep all of my packages up to date on a regular basis? i am happy to kick it off as a manual command, just want to try and stick to one way for upgrading.

i used to run the command:

```
portsnap fetch update && portupgrade -apPDR --batch
```
however over the past day i have reinstalled all of my ports and upgraded to 8.1 in the mean time with the following command: 

```
portsnap fetch update && portmaster -a
```

Which way do you all use to update your system and install all the necessary ports that have upgrades available? i am happy to recompile the individual upgrades for the ports every time if thats the best way.

cheers.


----------



## wblock@ (Sep 25, 2010)

Upgrading FreeBSD Ports is an article I wrote recently to try to cover the most important points of keeping ports updated.  As usual, feedback is welcome.


----------



## renice (Sep 25, 2010)

If you want to handle your system with packages only there's is a helpful tool at sysutils/bsdadminscripts called *pkg_upgrade*


----------



## ahavatar (Sep 28, 2010)

wblock said:
			
		

> Upgrading FreeBSD Ports is an article I wrote recently to try to cover the most important points of keeping ports updated.  As usual, feedback is welcome.


It would be great if there's a second part of the article for lazy people like me who prefers pre-compiled binaries(packages) if available.


----------



## wblock@ (Sep 28, 2010)

ahavatar said:
			
		

> It would be great if there's a second part of the article for lazy people like me who prefers pre-compiled binaries(packages) if available.



Thanks, but I almost never use packages, so have little useful experience with them.


----------



## DutchDaemon (Sep 29, 2010)

Look again at post #3, or use the *-PP* flag to either portupgrade(1) or portmaster(8).


----------



## dave (Oct 4, 2010)

Add something like this to your crontab to keep your ports tree up to date automatically, so you don't have to wait for the download and extract while working:


```
# Update the Ports Tree: Weekly
0       3       *       *       6       root    /usr/sbin/portsnap cron update > /dev/null 2>&1
```

I also send an email with a list of ports needing updates via crontab:


```
# List Updated Ports: Weekly
44      4       *       *       6       root    /usr/local/sbin/portmaster -L |grep -i "new version" | mail -s "`hostname -s`: Port Update" you@yourdomain.com
```

I always use sysutils/screen in case I get disconnected during a lengthy upgrade process:

`$ screen -S portup`

Something like this will usually do the trick:

`$ sudo portmaster -badH`

*[CTRL]-a then d* will detach your screen session so you can do other stuff.  To reattach, use:

`$ screen -rS portup`

I prefer portmaster to portupgrade.  I have simply had more success with it.


----------



## DutchDaemon (Oct 4, 2010)

Leave the system crontab (/etc/crontab) well alone, because system upgrades may touch/alter it. If you want root to run a job, use root's own crontab (crontab -e as the root user). This goes for all system users, btw.


----------

