So, you installed FreeBSD hoping to get a clean system with every package made specifically for it. You soon find out that the package manager doesn’t update regularly and you wind up getting security vulnerabilities unfixed for longer. You want to use ports and you probably tried portmaster but it is extremely slow and requires you to watch and keep up with the compiling. Luckily, there is a program that multithreads port compilation and looks cool in the process in order to speed up FreeBSD port compilation. This program is called synth for FreeBSD, and I will show you how to use it. Synth is available here on GitHub: https://github.com/jrmarino/synth.
NOTE: I recommend following this tutorial as well before following this one: First Things to Do to set up FreeBSD
What Is Synth, and How Does it Work?
Synth is made for people who want to use ports, but they don’t want the hassles that come with it. They want everything to suit their needs. Synth multithreads port compilation. That way not only does it require less configuration, but it also compiles ports faster than you would get with portmaster.
I will note that the less configuration you have to do with synth comes at a cost. I recommend using portmaster for a few months on a FreeBSD machine before going directly to synth. That way, each of the ports will be configured for your needs first and you can speed up FreeBSD port compilation later. Otherwise, you don’t have much use for ports. So if this is a brand new install, save this article, and come back in a couple of months.
Synth also looks extremely cool while it’s working. It is sure to impress your friends! (Don’t use it to impress a random girl at a bar, of course :p)
Setup to Speed up FreeBSD Ports with Synth
Synth requires some initial first-time setup, and will take longer the first time it’s used compared to other times. First, you will want to of course install synth itself. Run the following as root:
pkg install synth
Now that synth is installed, configure synth itself. Type the following:
For most use cases, the default options are fine for speeding up FreeBSD ports with Synth.
Run the following command to build the ports that need to be built:
That is the command you can run each time to upgrade the FreeBSD system.
BONUS: How to Know when Packages Need to be Updated and Make it Easy to Update Packages:
On my server, I always want to know when packages need to be updated. This is why I’ve configured the .zprofile (or .bash_profile, or any .profile) to run the following at startup:
echo Packages to upgrade: /usr/sbin/pkg version | grep -v = | wc -l alias list-updates="pkg version -vIL="
That code looks at how many packages need to be updated. Type “list-updates” to find out what needs to be updated. Perform a cron job every day that updates the ports tree. Run the following command as root:
Type on a new line:
@daily portsnap auto
Save and quit the file. That installs the new crontab, so FreeBSD updates the ports tree daily.