macos - 无法在 Mac 上安装 sbt

标签 macos scala sbt

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

但是我被困在第一步:

Put sbt-launch.jar in ~/bin.

我想我已经把 sbt 放入 bin 了 screenshot of bin location

然后我尝试通过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$ 

这对每个人来说可能都是一个非常简单的问题,但在 Coursera 类(class)的“设置我的工具”阶段陷入 3 小时的学习过程中,这真是令人难以置信的令人沮丧。

<小时/>

更新为通过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]    ^

最佳答案

由于您手动安装了它,然后使用了 brew,因此可能存在冲突文件,您应该首先将其删除以开始清理:

sudo rm /usr/local/bin/sbt

然后您可以使用 MacPortsHomebrew 重新安装:

MacPorts:

port install sbt

自制:

brew install sbt

您可能需要使用其中任一命令发出 sudo 命令,具体取决于您的环境。我更喜欢 MacPorts,但您决定使用哪一个完全取决于您的偏好。

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

brew link --overwrite sbt

关于macos - 无法在 Mac 上安装 sbt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32293324/

相关文章:

macos - NSTableView 带有 +/- 按钮,就像在系统偏好设置中仅使用 Interface Builder

qt - 删除 QGridLayout 中的所有间距

jquery - 为什么 OS X 上的 FF 在单击事件处理程序中丢失了 jQuery-UI?

java - Scala Spring Boot Autowiring 不起作用

scala - 根据 Scala 中的键从映射中的数组中获取值

docker - 将 Play 应用程序构建为 Docker 镜像,重新映射端口

macos - 无法在 Linux 和 macOS 上安装 EB CLI(错误 : The Python ssl extension was not compiled. 缺少 OpenSSL 库?))

scala - 如何引用外部本地sbt项目设置多模块构建?

scala - 下载异常 : sun. security.validator.ValidatorException:未找到受信任的证书