21

I installed SBT v0.12.4. Now I want to update it to v0.13.x, so I have used the command

brew install sbt

It says that it has correctly installed SBT 0.13.x. but if I ask on terminal the version of SBT, it says 0.12.4. How to update it?

2
  • What is the output of the following commands ls -l /usr/local/bin/sbt and ls -l /usr/local/Cellar/sbt*?
    – Saket
    Commented Nov 3, 2014 at 15:25
  • lrwxr-xr-x 1 alessio.crestani admin 28 3 Nov 15:50 /usr/local/bin/sbt -> ../Cellar/sbt/0.13.6/bin/sbt and for the second command it gives me 0 total result. Commented Nov 3, 2014 at 15:36

4 Answers 4

28

There are two sbt versions:

  1. The sbt-launcher. This is used to download and run a particular sbt version. This is what you installed with brew. If you type sbt --version it should tell you the version of the launcher brew installed.

  2. sbt itself (for building projects). This is controlled via a project/build.properties file by project. So one launcher can launch many versions of sbt, and is generally backwards compatible. To update this version, simple change the sbt.version property in project/build.properties.

3
  • thanks, my launcher is 0.13.6 and in the project 0.12.4. I don't see the build.properties because android studio doesn't show mw up this file, I've to manually enter with finder on the folder. Commented Nov 3, 2014 at 15:38
  • 1
    sbt --version does not work for me currently, (running 0.13.12 btw), but I need to run sbt sbt-version to get the version information.
    – Moodragonx
    Commented Oct 20, 2017 at 3:27
  • 1
    sbt sbt-version didn't work for me - sbt sbtVersion did though. Commented Jan 15, 2020 at 10:28
17

If you want to upgrade the version of sbt installed by homebrew, use:

brew upgrade sbt

You can check what version of sbt is in use with sbt about

6

check sbt version:

sbt sbtVersion

upgrade sbt version:

brew upgrade sbt  
0

There is an alternative sbt-launcher with source code here paulp/sbt-extras that allows specifying sbt version within command line.

Installing sbtx

brew install --HEAD paulp/extras/sbtx

Or

curl -Ls https://git.io/sbt > ~/bin/sbt && chmod 0755 ~/bin/sbt

Building project with desired sbt version

sbt -sbt-version 1.2.5 clean test

Not the answer you're looking for? Browse other questions tagged or ask your own question.