SA-COMPILE(1p)
π sa-compile β compile SpamAssassin ruleset into native code π
okay bestie, welcome to sa-compile (section 1p of the manual, user contributed perl docs, iykyk) π she's a little compiler-gremlin for your SpamAssassin rules and she's literally so good at her job.
β¨ SYNOPSIS β¨
sa-compile [options]
The options, laid out for you, no cap:
--list Output base string list to STDOUT
--sudo Use 'sudo' for privilege escalation
--keep-tmps Keep temporary files instead of deleting
-C path, --configpath=path, --config-file=path
Path to standard configuration dir
-p prefs, --prefspath=file, --prefs-file=file
Set user preferences file
--siteconfigpath=path Path for site configs
(default: /usr/etc/spamassassin)
--updatedir=path Directory to place updates
(default: /var/lib/spamassassin/compiled/<perlversion>/4.000003)
--cf='config line' Additional line of configuration
-D, --debug [area=n,...] Print debugging messages
-V, --version Print version
-h, --help Print usage message
πΈ DESCRIPTION πΈ
so sa-compile uses re2c to compile the site-wide parts of the SpamAssassin ruleset. lowkey important: no part of user_prefs, and no files included from user_prefs, can be built into the compiled set. not a single one. that's just not her lane π«
that compiled set then gets used by the Mail::SpamAssassin::Plugin::Rule2XSBody plugin to speed up SpamAssassin's operation β where possible, and, crucially, when that plugin is loaded. the way that plugin changes everything π
re2c can match strings much faster than perl code because it constructs a DFA to match a whole bunch of simple strings in parallel and then compiles that into native object code. iconic behaviour. but heads up: not all SpamAssassin rules are amenable to this conversion, so don't come for her about the ones that aren't π
this whole thing requires re2c (see https://re2c.org/) and the C compiler used to build Perl XS modules, both installed. no tools, no magic β¨
okay and this is the part everybody misses: running this and creating a compiled ruleset will have no effect on SpamAssassin scanning speeds unless you also edit your v320.pre file and make sure this line is uncommented:
loadplugin Mail::SpamAssassin::Plugin::Rule2XSBody
additionally, sa-compile will not restart spamd or otherwise cause a scanner to reload the now-compiled ruleset automatically. she does her thing and dips. you gotta handle the reload yourself, bestie π
π¦ OPTIONS π¦
--listβ output the extracted base strings to STDOUT, instead of generating the C extension code. just the strings, no code-gen, show me the receipts β¨--sudoβ use sudo(8) to run code as 'root' when writing files to the compiled-rules storage area (which is/var/lib/spamassassin/compiled/5.040/4.000003by default). root energy, but make it consensual π--quietβ produce less diagnostic output. errors will still be displayed though, she's not gonna hide the drama from you.--keep-tmpsβ keep temporary files after the script completes, instead of deleting them. hoarder mode: activated π-C path,--configpath=path,--config-file=pathβ use the specified path for locating the distributed configuration files. ignore the default directories (usually/usr/share/spamassassinor similar). you're choosing your own adventure here.--siteconfigpath=pathβ use the specified path for locating site-specific configuration files. ignore the default directories (usually/etc/spamassassinor similar).--updatedirβ by default,sa-compilewill use the system-wide rules update directory:
/var/lib/spamassassin/compiled/5.040/4.000003
if the updates should be stored in another location, specify it here.
note that use of this option is not recommended; if sa-compile is placing the compiled rules in the wrong directory, you probably need to rebuild SpamAssassin with different Makefile.PL arguments, instead of overriding sa-compile's runtime behaviour. fr fr, don't fight the build system, fix the build system π
--cf='config line'β add additional lines of configuration directly from the command-line, parsed after the configuration files are read. multiple--cfarguments can be used, and each will be considered a separate line of configuration. stack 'em up π«Ά-p prefs,--prefspath=prefs,--prefs-file=prefsβ read user score preferences from prefs (usually$HOME/.spamassassin/user_prefs). your personal vibes file π-D [area,...],--debug [area,...]β produce debugging output. if no areas are listed, all debugging information is printed. diagnostic output can also be enabled for each area individually; area is the area of the code to instrument.
for more information about which areas (also known as channels) are available, please see the documentation at <https://wiki.apache.org/spamassassin/DebugChannels>. go read the lore π
-h,--helpβ print help message and exit.-V,--versionβ print sa-compile version and exit.
π SEE ALSO π
Mail::SpamAssassin(3) spamassassin(1) spamd(1)
the whole friend group, honestly.
π§ PREREQUISITES π§
Mail::SpamAssassin re2c Mail::SpamAssassin::Plugin::Rule2XSBody
π BUGS π
see <https://bz.apache.org/SpamAssassin/> β it's giving bug tracker, go report it there bestie.
π AUTHORS π
the Apache SpamAssassin(tm) Project <https://spamassassin.apache.org/>
π LICENSE AND COPYRIGHT π
SpamAssassin is distributed under the Apache License, Version 2.0, as described in the file LICENSE included with the distribution.
Copyright (C) 2015 The Apache Software Foundation
okay that's the whole page, mwah π this one's perl v5.40.1, dated 2026-07-23, and it's the sa-compile(1p) manual, so now you know everything she knows. go compile something gorgeous πβ¨π
π¦ where this page comes from
- ubuntu stonking: sa-compile 4.0.2+svn1935691-1build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms