Wednesday, December 29, 2010

Homebrew now has an improved sbt launcher script

In my latest adventures with Scala, I've gone all in, and have been using sbt as my build tool of choice. And, given that I hate installing things myself, I installed using the world most awesome package manager for Mac, Homebrew.

Lately, though, I've been having trouble with sbt running out of permgen space. Rather than just making some local mods to my launcher script, I patched Homebrew's launcher script, which adamv quickly accepted. (Thanks!)

If you used Homebrew to install sbt on your Mac, the next time you update you'll find the launcher more configurable.

Create a file in your home directory named .sbtconfig. In that file, you can define the environment variable SBT_OPTS to be to extra options passed to Java when launching sbt. You can set -Xmx, -XX:MaxPermSize, or any other tuning you might find necessary, (such as -XX:+CMSClassUnloadingEnabled). My file looks like this:
SBT_OPTS="-XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m"
I hope running out of permgen is now a thing of the past. We'll see!