Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I install software from ports on a FreeBSD system, sometimes rather outdated versions of Apache/MySQL/Perl/etc are installed as dependencies. Is there any way to set the versions of these ports beforehand so that if they're ever required, the ports system would choose an appropriate version?

share|improve this question
up vote 3 down vote accepted

You can look in /usr/ports/Mk/bsd.*.mk for corresponding variables and set them in /etc/make.conf. But it's safer to just install needed versions of such software and then continue with everything else.

share|improve this answer

Set for example:

DEFAULT_VERSIONS=   perl5=5.18 ruby=2.0

in your /etc/make.conf

This information is taken from /usr/ports/Mk/

# $FreeBSD: head/Mk/ 345909 2014-02-25 00:32:09Z gerald $
# Provide default versions for ports with multiple versions selectable
# by the user.
# Users who want to override these defaults can easily do so by defining
# DEFAULT_VERSIONS in their make.conf as follows:
#   DEFAULT_VERSIONS=   perl5=5.18 ruby=2.0


.for lang in ${DEFAULT_VERSIONS}
_l=             ${lang:C/=.*//g}
${_l:U}_DEFAULT=        ${lang:C/.*=//g}

APACHE_DEFAULT?=        2.2
FPC_DEFAULT?=           2.6.2
GCC_DEFAULT?=           4.6
LUA_DEFAULT?=           5.2
MYSQL_DEFAULT?=         5.5
PERL5_DEFAULT?=         5.16
PGSQL_DEFAULT?=         9.0
PHP_DEFAULT?=           5.4
PYTHON_DEFAULT?=        2.7
PYTHON2_DEFAULT?=       2.7
PYTHON3_DEFAULT?=       3.3
RUBY_DEFAULT?=          1.9
TCLTK_DEFAULT?=         8.6

share|improve this answer

The version of the port is the version that the port maintainer has built and tested (and that gets routinely build-tested by the ports tinderbox) -- I don't know of any ports that have a version knob, though you can find multiple versions of some ports in the tree (for example, PostgreSQL has versions from 7.3 through 9.0).
You can install the newer versions of these ports manually and (if they're suitable) they will be found as dependencies and used by other ports.

The general answer for port upgrades is that if you want a newer version of a port than what's in the tree you can create and submit a patch that updates the port (A cursory read through The FreeBSD Porter's Handbook may be a good idea to get familiar with how things work in the ports tree).
If your newer version introduces incompatible changes you should probably create a new port for it (you can use the older version as a skeleton).

share|improve this answer
mysql has a version knob: grep ^DEFAULT_MYSQL_VER /usr/ports/Mk/ – eugene y Apr 1 '11 at 16:35
@eugene y Hmm, I forgot about those .mk files -- looking around there appears to be one for DEFAULT_PGSQL_VER as well & a few others . You can definitely set these in /etc/make.conf or on the command line. I don't know if there are knobs for everything you need to touch, but it may be a good start & an automated script can handle the rest... – voretaq7 Apr 1 '11 at 16:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.