# pkgng - upgrade specific package



## ahhyes (May 14, 2014)

Hi,

Running a FreeBSD 10 server.

Is it possible to have pkg(8) upgrade a specific package only?

If I run the `pkg upgrade` command, it gives me a whole list of packages it can upgrade, what it needs to reinstall if a dependency has changed etc. I have some packages for example that I do not want pkg(8) getting its grubby hands on because I had to compile them from ports (default options in several packages were not appropriate for me (exim, dovecot etc)). I would like to be able to upgrade specific packages only so I don't have to go deinstalling, recompiling things from ports to put things back that will be clobbered by a pkg-upgrade(8) (since it wants to only allow an upgrade of the entire list).

For example:


```
root@core:~ # pkg upgrade
Updating repository catalogue
Upgrades have been requested for the following 84 packages:
	Upgrading bash: 4.3.0_1 -> 4.3.11_2
```

Out of the list, why can't I just simply choose to `pkg upgrade bash`? Why do I have to do the lot (there's no direct dependency change for bash in this case).

Quote from the pkg(8) man page:


```
upgrade
             Upgrade a package to a newer version.
```

That is misleading. Since I was not able to find any documentation on how to update a single "package" (note, man page does not imply plural, giving the impression it should be possible to target a single package). This is a really annoying limitation. It would be nice if we had some of the linux'ims with pkg(8), like how apt" works. eg: `apt-get upgrade bash`.


----------



## ahhyes (May 14, 2014)

Is `pkg -f install <packagename>` the solution?


----------



## trh411 (May 14, 2014)

ahhyes said:
			
		

> Is `pkg -f install <packagename>` the solution?


Yes. The -f option is only required if you want to force the re-installation of an already installed package. See pkg-install(8).


----------



## mix_room (May 14, 2014)

I agree that it would be nice to have, and that the wording is misleading. 

However, the following should do the trick for you: 


```
pkg lock bash
pkg upgrade
```

Locking the package prevents pkg from 'getting its grubby hands on it'. Just remember to unlock when you want to upgrade the specific program.


----------



## ahhyes (May 20, 2014)

mix_room said:
			
		

> I agree that it would be nice to have, and that the wording is misleading.
> 
> However, the following should do the trick for you:
> 
> ...



This worked a treat, thank you!


----------

