Synth - ports-mgmt/synth

Synth - ports-mgmt/synth

Synth is best summed up by the first paragraph of at the maintainer's github site.

Synth is an advanced concurrent (parallel) ports building tool aimed at regular users that prefer
or require building their own packages from source. Synth will build packages in a clean environment
that exactly mirrors the system it builds on, creates a local repository, installs a pkg repository
configuration file that causes the local packages to be used with the highest priority,and automatically
upgrades the system with a single command.

It is further described by its own pkg-descr file.

Synth is a custom package repository builder for FreeBSD and DragonFly.

It is intended to replace Portmaster, portupgrade, and poudriere for
the average user.  It is simple to learn (the powerful options are
limited in number) and user-friendly, but it is extremely fast due
to its parallel building capability.  It will "drop-in" on any system
as it leverages the stock pkg(8) facilities.  All ports are built
in a clean environment, so it is finally safe to build ports as
needed on a live system.  The default profile is the system itself, not
a new jail, which can be a valuable feature for some environments.

To bring a system up-to-date only requires one command after the ports
tree is updated:

  > synth upgrade-system



Synth is a relatively recent addition to FreeBSD's ports, added on Jan 2016. It supports Flavors and is actively maintained. Synth builds ports for its repository in its own build directories leaving the system's ports tree unmodified.

If Synth is being installed on an already established system with many packages and services already installed, then the first-run will be the longest as it compiles all installed packages for it's own repository.

NOTE: FreeBSD base system uses specific default versions of programming language ports: Perl 5.30, Python 3.6, PHP 7.2.

If the system is kept up to date with current release versions of these languages then the overrides will be in /etc/make.conf

DEFAULT_VERSIONS+= perl5=5.30 python=3.8 python3=3.8 php=7.4

If /etc/make.conf exists on the system it should be copied to /usr/local/etc/synth/LiveSystem-make.conf prior to running Synth for the first time to ensure Synth also uses the correct versions.


Port Make Config Options

If no configuration options exists for any given port, Synth will not present you with the options dialog, and will proceed with defaults for all options. If you do need to make changes to a given port's config options, then prior to running Synth simply cd to the given port's directory, manually run make config, and saving the changes. When Synth builds a port it will use any respective saved configuration options if they exist.

Occasionally an error similar to the following, will stop the upgrade-system process before Synth moves to the build phase:

A preliminary scan has revealed the cached options of 2 ports are
obsolete.  Please update or remove the saved options and try again.
  e.g. make -C /usr/ports/devel/oniguruma config
  e.g. make -C /usr/ports/devel/oniguruma rmconfig
Unfortunately, the system upgrade failed.

The solution is to save a new config or remove it using one of the two respective examples provided. This will need to be done for each port identified by Synth. Once all configurations have been resolved Synth should continue on to the build phase.

To avoid this problem, marino has written a tool script /usr/ports/Tools/scripts/ that will display the full path to the port's options directory if the cached options are the same as the defaults. This output is suitable to pipe to "xargs rm -rf" to remove all the redundant options in a single command.
/usr/ports/Tools/scripts/ | xargs rm -rf

Whenever you are presented with make config options dialogs, if you do not need to change the default choices, then optimally either hit ESC or Cancel the options dialog instead of selecting OK to save those (default) options.

When using make to build ports from the ports tree, you can skip all configuration options dialogs by adding -DBATCH to the make command line.
e.g. make install clean -DBATCH


Suggested Workflow

portsnap auto to update the ports tree.
pkg version -vPL= to determine if any packages require updating.

If packages have updates then
synth status  to do the scan of the updated ports tree and to do a dry run of upgrade-system.
synth upgrade-system to build and install the updates.


To automate the workflow add the following series of commands to root's crontab:

portsnap auto > /dev/null; ( pkg version -vPL=; synth status; )

Upon receiving the email from the completed crob job notifying you there are updates to install, login and install the updates:
synth upgrade-system


When Synth begins building packages it will display a ncurses status page like this:

Example of displayed info while Synth is building packages

Once all the ports have been compiled into packages, Synth then updates its local repository with them.

Lastly Synth compares packages in its local repository to the packages installed on the system, installing, reinstalling, or upgrading them as required.


Synth can also be used to build and install new ports to the system. As opposed to first installing the port directly from the ports tree and then running Synth afterwards to sync it's repository with the system.

synth install port-origin

Refer to Synth(1) for more information regarding this and other available command options.