# forcing default version of perl



## tvs (Feb 25, 2014)

Hi,

I'm trying to install several packages on a clean FreeBSD 10.0 box. One thing I really need is to have perl 5.18 installed (and ONLY that version); the problem is that, when I install several packages using ports, it installs perl 5.16. How can I prevent this? Is there any way I can force to use version 5.18 for everything?

Thanks in advance for any help!


----------



## ShelLuser (Feb 25, 2014)

Yes, this can be done using the DEFAULT_VERSIONS variable in /etc/make.conf. This variable can be used for most 'major' ports. So in this case you could use something like:


```
DEFAULT_VERSIONS=perl5=5.18
```
See 20130920 in /usr/ports/UPDATING for the introduction of this variable. See /usr/ports/Mk/bsd.default-versions.mk to keep up which ports will honour this variable.

Finally; this works with the Ports collection only. That's because binary packages have been pre-build by others using default options. And the default Perl version on FreeBSD is lang/perl5.16 (at the time of writing of course).


----------



## wblock@ (Feb 25, 2014)

Last I heard, Perl 5.18 broke some backward compatibility, and that was the reason 5.16 is still the default.


----------



## xtaz (Feb 26, 2014)

You don't actually need to use the DEFAULT_VERSIONS thing. You just have to make sure you install lang/perl5.18 by itself first, and THEN install whatever depends upon it. Then it just uses that version and doesn't try and install the default. Although the proper way to do things is as mentioned above I guess! I've been using 5.18 myself for several months. Haven't noticed any major issues other than some older scripts throw some more warnings. Most noticeably mail/p5-Mail-SpamAssassin which needs a patch to be applied for it to suppress the warnings.


----------



## tvs (Mar 1, 2014)

ShelLuser said:
			
		

> Yes, this can be done using the DEFAULT_VERSIONS variable in /etc/make.conf. This variable can be used for most 'major' ports. So in this case you could use something like:
> 
> 
> ```
> ...



Thank you ShelLuser! I've did what you suggested and it worked perfectly!


----------

