# Prevent pkg install to re-install dependencies



## Carpetsmoker (Feb 6, 2014)

```
[~]# pkg install php55-filter
The following 2 packages will be installed:

        Reinstalling php55-5.5.8 (options changed)
        Installing php55-filter: 5.5.8
```

`pkg` insist on reinstalling the PHP package because the options changed. However, this will break my existing PHP install (I added php-fpm), and installing php55-filter will work fine without reinstalling it (In other words: I know what I'm doing™).

Is there any way to prevent this?


----------



## junovitch@ (Feb 6, 2014)

`pkg lock php55` should do the trick.


----------



## Carpetsmoker (Feb 7, 2014)

Indeed it does, thanks!


----------



## Carpetsmoker (Mar 1, 2014)

So, while this "works", I now have to 'lock' almost every package in my system, to prevent upgrading 40 packages to some portrevision or minor update, or, more often than not, something I intentionally compiled myself with a different option.

`pkg install -d pkgname`

Where -d is "don't update any dependencies".

After all, I'm asking for *install*, not *update*. This seems to be a missing feature?


----------



## ShelLuser (Mar 1, 2014)

Carpetsmoker said:
			
		

> After all, I'm asking for *install*, not *update*. This seems to be a missing feature?


I'm not too sure about that. In the end I think it simply boils down to the issue of mixing the use of binary packages and the Ports collection. And that is usually a recipe for trouble, to my knowledge it always has been.


----------



## Carpetsmoker (Mar 1, 2014)

ShelLuser said:
			
		

> Carpetsmoker said:
> 
> 
> 
> ...



It's perfectly fine, in fact, I would say mixing ports & packages is almost always the most sensible thing to do.

For example, installing all the mplayer dependencies as a package, while installing mplayer as a port with the GUI option disabled, and then install a package that depends on mplayer. Seems perfectly fine to me.
Or, in my original example, installing the php port with php-fpm option enabled, and then install a bunch of extensions as a package.

The only (potential) problem I can think of, is installing a bunch of ports with an up-to-date port tree, and then installing a package, which is linked against an older version of a library (ie. libfoo.so.5, while you have libfoo.so.6 installed). Well, this problem is not only quite rare, it's also easily diagnosed & fixed.


----------

