fsc(1)
π fsc β the offline compiler era π
okay so bestie, you're looking at the manual page for fsc, section 1 of the USER COMMANDS, aka Fast offline compiler for the Scala 2 language. yes it's giving "my laptop is warm and I'm thriving". let's get into it π¦
β¨ NAME β¨
fsc β Fast offline compiler for the Scala 2 language
β¨ SYNOPSIS β¨
fsc [ <options> ] <source files>
β¨ PARAMETERS β¨
<options>β command line options, bestie. the whole list lives down in OPTIONS π<source files>β one or more source files you wanna compile, likeMyClass.scala. plural, she's flexible π
β¨ OPTIONS β¨
so the offline compiler supports all the options of scalac β all of them, no cap β plus these extra little icons:
-resetβ reset compile server caches. clean slate energy β¨-shutdownβ shut down the compilation daemon. she tries to restart herself whenever she needs to, but sometimes you gotta be explicit and say "girl, log off". a super common reason is when jars on the class path have changed.-server <hostname:portnumber>β specify the compile server host at that port number. usually you don't need this one. important though: the hostname has to be for a host that shares the same filesystem. sharing is caring, fr fr.-J<flag>β pass<flag>directly to the Java VM for the compilation daemon. straight to the JVM, no middleman π«Ά
β¨ DESCRIPTION β¨
okay so here's the whole vibe: fsc submits Scala compilation jobs to a compilation daemon. the first time you run it, the daemon starts automatically, all by herself. on subsequent runs, the same daemon can be reused β which means faster compilation. the tool is especially effective when you're repeatedly compiling with the same class paths, because the compilation daemon can reuse a compiler instance. obsessed. π
the compilation daemon is smart enough to flush its cached compiler when the class path changes. however β and listen, this part matters β if the contents of the class path change, for example because you upgraded a library, then the daemon should be explicitly shut down with -shutdown. don't let her cling to stale vibes π
also note: the scala script runner will use the offline compiler by default too, with all the same advantages and the same caveats. iykyk.
β¨ EXAMPLE β¨
this session right here shows a typical speed up from using the offline compiler. watch the glow-up π
> fsc -verbose -d /tmp test.scala
...
[Port number: 32834]
[Starting new Scala compile server instance]
[Classpath = ...]
[loaded directory path ... in 692ms]
...
[parsing test.scala]
...
[total in 943ms]
> fsc -verbose -d /tmp test.scala
...
[Port number: 32834]
[parsing test.scala]
...
[total in 60ms]
> fsc -verbose -d /tmp test.scala
...
[Port number: 32834]
[parsing test.scala]
...
[total in 42ms]
> fsc -verbose -shutdown
[Scala compile server exited]
look at that: 943ms β 60ms β 42ms. she ate and left no crumbs π₯
β¨ ENVIRONMENT β¨
JAVACMDβ specify the java command to be used for running the Scala code. arguments may be specified as part of the environment variable; spaces, quotation marks, etc., will be passed directly to the shell for expansion. she's not gonna clean it up for you, bestie, the shell handles it.JAVA_HOMEβ specify the JDK/JRE home directory. this directory is used to locate thejavacommand unlessJAVACMDvariable set.JAVA_OPTSβ specify the options to be passed to thejavacommand defined byJAVACMD.
with Java 1.5 (or newer) one may for example configure the memory usage of the JVM as follows: JAVA_OPTS="-Xmx512M -Xms16M -Xss16M" π§
β¨ EXIT STATUS β¨
fsc returns a zero exit status if it succeeds to compile the specified input files. non zero is returned in case of failure. zero = slay, non-zero = not slay π
β¨ AUTHOR β¨
written by Martin Odersky and other members of the Scala team. shoutout the whole team π«Ά
β¨ REPORTING BUGS β¨
report bugs to https://issues.scala-lang.org/. please do, they wanna know π
β¨ COPYRIGHT β¨
this is open-source software, available to you under a BSD-like license. see accompanying "copyright" or "LICENSE" file for copying conditions.
there is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. like, none. zero. read the LICENSE, bestie π
β¨ SEE ALSO β¨
scala(1), scalac(1), scaladoc(1), scalap(1) β the whole friend group π
and that's the page, bestie! this was version 0.5, dated March 2012, and it lives under section fsc(1). yes we're reading a 2012 manpage and yes it's still iconic. take care of your daemon, shut her down when your classpath changes, and go compile something beautiful β¨ππ
π¦ where this page comes from
- debian bookworm: scala 2.11.12-5 Β· BSD-3-Clause
- debian trixie: scala 2.11.12-6 Β· BSD-3-Clause
- ubuntu jammy: scala 2.11.12-5 Β· BSD-3-Clause
- ubuntu noble: scala 2.11.12-5 Β· BSD-3-Clause
- ubuntu questing: scala 2.11.12-6
- ubuntu resolute: scala 2.11.12-6build1 Β· BSD-3-Clause
- ubuntu stonking: scala 2.11.12-6build1 Β· BSD-3-Clause
- (c) 2002-2013, LAMP/EPFL #
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms