Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to install sbt on Mac

Tags:

macos

scala

sbt

Hi I have been trying to install SBT on mac by following in instruction at http://www.scala-sbt.org/0.13/tutorial/Manual-Installation.html

however I am stuck at the first step:

Put sbt-launch.jar in ~/bin.

I think I put sbt in bin already screenshot of bin location

Then i tried to install it through brew and the installation process went okay. But then when I checked for sbt version to confirm installation. I got a new error message:

vtmbpr:~ VT$ brew install sbt
Warning: You are using OS X 10.11.
We do not provide support for this pre-release version.
You may encounter build failures or other breakage.
==> Downloading https://dl.bintray.com/sbt/native-packages/sbt/0.13.9/sbt-0.13.9.tgz
######################################################################## 100.0%
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/sbt
Target /usr/local/bin/sbt
already exists. You may want to remove it:
  rm '/usr/local/bin/sbt'

To force the link and overwrite all conflicting files:
  brew link --overwrite sbt

To list all files that would be deleted:
  brew link --overwrite --dry-run sbt

Possible conflicting files are:
/usr/local/bin/sbt
==> Caveats
You can use $SBT_OPTS to pass additional JVM options to SBT:
   SBT_OPTS="-XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"

This formula is now using the standard typesafe 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
==> Summary
🍺  /usr/local/Cellar/sbt/0.13.9: 5 files, 1.2M, built in 7 seconds
vtmbpr:~ VT$ sbt
Error: Unable to access jarfile /usr/local/bin/sbt-launcher.jar
vtmbpr:~ VT$ $ sbt
-bash: $: command not found
vtmbpr:~ VT$ sbt --version
Error: Unable to access jarfile /usr/local/bin/sbt-launcher.jar
vtmbpr:~ VT$ 

This might be a really simple question to everyone but it is incredibly frustrating to get stuck at even "getting my tool setup" stage of a coursera course for 3 hours of gooling.


Updated to remove and reinstall through brew. How could I tell if sbt is running okay afterwards? I tried running sbt --version but was thrown a set of errors.

vtmbpr:~ VT$ sudo rm /usr/local/bin/sbt
Password:
vtmbpr:~ VT$ port install sbt
-bash: port: command not found
vtmbpr:~ VT$ brew install sbt
Warning: sbt-0.13.9 already installed, it's just not migrated
Warning: You are using OS X 10.11.
We do not provide support for this pre-release version.
You may encounter build failures or other breakage.
vtmbpr:~ VT$ sbt
-bash: /usr/local/bin/sbt: No such file or directory
vtmbpr:~ VT$ sbt
-bash: /usr/local/bin/sbt: No such file or directory
vtmbpr:~ VT$ sbt --version
-bash: /usr/local/bin/sbt: No such file or directory
vtmbpr:~ VT$ brew link --overwrite sbt
Linking /usr/local/Cellar/sbt/0.13.9... 1 symlinks created
vtmbpr:~ VT$ sbt
s[info] Set current project to vt (in build file:/Users/VT/)
^R
> sbt --version
[error] Expected ID character
[error] Not a valid command: sbt (similar: set, boot, last)
[error] Expected project ID
[error] Expected configuration
[error] Expected ':' (if selecting a configuration)
[error] Expected key
[error] Not a valid key: sbt (similar: test, ivy-sbt, state)
[error] sbt --version
[error]    ^
like image 624
Victor Yip Avatar asked Aug 30 '15 04:08

Victor Yip


1 Answers

Since you've installed it manually and then used brew there might be conflicting files laying around, you should first remove it to start clean:

sudo rm /usr/local/bin/sbt

Then you can reinstall either with MacPorts or Homebrew:

MacPorts:

port install sbt

Homebrew:

brew install sbt

You might need to issue the sudo command with either of these depending on your environment. I prefer MacPorts, but whichever you decide to use is entirely your preference.

If you'd rather not reinstall sbt and try to force brew to link and overwrite all conflicting files, issue the command below, which hopefully will create the proper symlink:

brew link --overwrite sbt
like image 182
l'L'l Avatar answered Oct 25 '22 20:10

l'L'l