LoginSignup
20
12

More than 5 years have passed since last update.

[Mac]sbtの特定のバージョンをbrew installでインストールする方法

Last updated at Posted at 2017-11-23

最新のsbtは1.0系だが(2017年11月現在)0.13系のsbtをbrew installでインストールしたかったので調べました。
自分用メモです。

sbtのアンインストール

1.0系が入ってる場合はアンインストールする

$ brew uninstall sbt
Uninstalling /usr/local/Cellar/sbt/1.0.3... (494 files, 73.8MB)

インストールできるsbtのバージョンを調べる

sbtの0.13系があるのを確認する

$ brew search sbt
==> Searching local taps...
sbt                   sbt@0.13                  sbtenv
==> Searching taps on GitHub...
==> Searching blacklisted, migrated and deleted formulae...

0.13系をインストールする

$ brew install sbt@0.13   
==> Downloading https://dl.bintray.com/homebrew/mirror/sbt-0.13.16
######################################################################## 100.0%
==> Caveats
You can use $SBT_OPTS to pass additional JVM options to SBT:
   SBT_OPTS="-XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"

This formula uses the standard Lightbend sbt launcher script.
Project specific options should be placed in .sbtopts in the root of your project.
Global settings should be placed in /usr/local/etc/sbtopts

This formula is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/sbt@0.13/bin:$PATH"' >> ~/.zshrc

==> Summary
🍺  /usr/local/Cellar/sbt@0.13/0.13.16: 384 files, 63.5MB, built in 26 seconds

パスを通す

インストールした時の説明にも書いてあるがパスが通ってない場合があるのでパスを通す

# パスが通ってないので
$ which sbt
sbt not found

# パスに追加する
$ echo 'export PATH="/usr/local/opt/sbt@0.13/bin:$PATH"' >> ~/.zshrc

$ source ~/.zshrc 

# パスが通った!
$ which sbt
/usr/local/opt/sbt@0.13/bin/sbt

バージョン確認

0.13系がインストールできました

 $ sbt sbt-version
(省略)
[info] 0.13.16

一言

sbtじゃなくてもbrew installで特定のバージョンを入れるのはこの方法でいけそう

参考サイト

homebrewでバージョンを指定してパッケージを入れる。

20
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
20
12