无法在Mac上安装sbt

Vic*_*Yip 4 macos scala sbt

嗨,我一直在尝试按照http://www.scala-sbt.org/0.13/tutorial/Manual-Installation.html上的说明在Mac上安装SBT 。

但是我被困在第一步:

将sbt-launch.jar放入〜/ bin。

我想我已经将sbt放入bin中了 收件箱位置的屏幕截图

然后我尝试通过brew安装它,安装过程顺利。但是然后当我检查sbt版本以确认安装时。我收到新的错误消息:

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$ 
Run Code Online (Sandbox Code Playgroud)

对于每个人来说,这可能是一个非常简单的问题,但令人难以置信的是,他们陷入了长达3个小时的Coursera课程的“获取我的工具设置”阶段。


更新以删除并通过brew重新安装。之后如何判断sbt是否正常运行?我尝试运行sbt --version,但引发了一系列错误。

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]    ^
Run Code Online (Sandbox Code Playgroud)

l'L*_*L'l 5

由于您已经手动安装它,然后使用它,brew因此可能存在冲突的文件,因此应首先将其删除以进行清理:

sudo rm /usr/local/bin/sbt
Run Code Online (Sandbox Code Playgroud)

然后,您可以使用MacPorts或重新安装Homebrew:

MacPorts:

port install sbt
Run Code Online (Sandbox Code Playgroud)

自制:

brew install sbt
Run Code Online (Sandbox Code Playgroud)

sudo根据您的环境,您可能需要使用其中任一命令发出命令。我更喜欢MacPorts,但是无论您决定使用哪个,都是您的偏爱。

如果您不想重新安装sbt并尝试强制brew链接和覆盖所有冲突的文件,请发出以下命令,希望该命令将创建正确的符号链接:

brew link --overwrite sbt
Run Code Online (Sandbox Code Playgroud)