packages vs ports, do they conflict?

Polytropon freebsd at
Wed Dec 19 07:44:45 UTC 2018

On Tue, 18 Dec 2018 20:54:56 -0800, Ian Zimmerman wrote:
> I just tried to compile a port for the first time, and I tried to follow
> the Handbook as closely as possible, as is fitting for a newbie.  So,
> after becoming root in the port directory, the first thing I tried was
> "make config-recursive".  And the first dialog of options was for bash.
> So I guess this port has the bash port as a dependency.


> But I have
> already installed bash as a package!

That doesn't matter at this stage. As far as I know, the
dependency tree resolver just considers data from the ports
collection itself, there is no verification if something
is already installed - that would happen during port build
and dependency installation. It _might_ have a different
impact if a dependency is a build dependency or a runtime
dependency; build dependencies can be removed later on as
the program in question does not need it to run.

> If I go ahead with the build, will
> a bash port be built and installed too, overwriting the package
> installation - maybe with different and undesirable options?

That depends on the actual options. If you have installed
bash via pkg, the ports tree's default options have been
applied, and if you chose different options for bash _now_,
a re-installation with that new options will be performed.

Additionally, updating your installed software via pkg will
then surely remove your "custom bash" and replace it with
a newer "stock bash".

> How does
> this work in general?

Oh, that's very complicated... ;-)

> Can I mix packages and ports at all, or do I have
> to commit to one framework or the other for all software installs?

No, you can mix them within a certain "mindset":

If you're building ports with the default options, then
they will be equivalent to what you install via pkg.

When you're building a port, simply speaking, a package
is created, and pkg is then used to install that package.
For a normal "make install" call, an "implicite repository"
is assumed, which isn't a repository at all, just an
explicit package location and name.

As soon as you're _changing_ port options, conflicts
will arise. You'd have to use "pkg lock", then update
with pkg, then portsnap, then "pkg unlock", and finally
manually rebuild your custom ports. This is okay for
one or two custom ports, but if you have a lot of those,
things become inconvenient.

Using poudriere makes this a lot easier: You can create
your own repository (a real one!) containing all your
ports with non-default options, and pkg will source them
from your own machine, instead of using the ports with
the default options from the official locations. And
your build environment is nicely separated from your
actual OS installation, i. e., if something needs a
build dependency, it won't be installed into your main

It also does matter if you follow "Quarterly" or "Latest"
when using pkg and ports (ports tree updated with portsnap)
in parallel. With pkg's configuration file, you can setup
your source repositories according to your requirements.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list