User Tools

Site Tools


archive:freebsd_install_perl

How To Install Perl On FreeBSD

I prefer to install perl myself instead of having it installed as a dependency from another program.

There are some versions to chose from when deciding to install perl. The newest version may sometimes be just a number to “fresh”.

As of current writing 4 versions are currently avaiable for FreeBSD 10.

/usr/ports/lang/perl5.18
/usr/ports/lang/perl5.20
/usr/ports/lang/perl5.22
/usr/ports/lang/perl5.24

Im currently running Perl5.20 but it's really up to you to decide what version to install to install the newest version as of writing perl5.24 run.

cd /usr/ports/lang/perl5.20 && make install clean BATCH=yes

Important: Many programs are still relying on perl beeing located in /usr/bin like for example VMware Tools, but perl now installes itself in /usr/local/bin. Luckily we can have our cake and eat it too. Add the following symlink to solve the issue.

cd /usr/bin
mv perl perl.old
ln -s /usr/local/bin/perl perl

Note: The above command mv perl perl.old should result in an error as perl should not yet be there until symlinked.

Worth mentioning is when you try to install perl later than 5.20 on FreeBSD you will get pop with a warning saying.

##################################################

This is NOT the DEFAULT perl version

It will NOT install /usr/local/bin/perl

It will ONLY install /usr/local/bin/perl5.24.0

The default Perl version currently is 5.20.

If you want to use this version as the default, stop the build now, add this line to your /etc/make.conf, and then restart the build.

DEFAULT_VERSIONS+=perl5=5.24

##################################################

So caution is advised when installing any other version than perl5.20 on your system.

Verify your installation by issuing the following command.

perl -v
archive/freebsd_install_perl.txt · Last modified: 24/11/2023 12:28 by Allan