无法在Mac上安装sbt

时间:2015-08-30 04:59:13

标签: macos scala sbt

您好我一直在尝试按照http://www.scala-sbt.org/0.13/tutorial/Manual-Installation.html

中的说明在Mac上安装SBT 然而,我在第一步陷入困境:

  

将sbt-launch.jar放入〜/ 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$ 

对于每个人来说,这可能是一个非常简单的问题,但是即使在“获得我的工具设置”课程中遇到3个小时的gooling也会非常令人沮丧。

已更新,可通过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]    ^

1 个答案:

答案 0 :(得分:4)

由于您已手动安装并使用X * Copyright (c) 1992 David I. Bell X * Permission is granted to use, distribute, or modify this source, X * provided that this copyright notice remains intact. X/* X * SIMULATE_STDARG X * X * WARNING: This type of stdarg makes assumptions about the stack X * that may not be true on your system. You may want to X * define STDARG (if using ANSI C) or VARARGS. X */ X Xtypedef char *va_list; X#define va_start(ap,parmn) (void)((ap) = (char*)(&(parmn) + 1)) X#define va_end(ap) (void)((ap) = 0) X#define va_arg(ap, type) \ X (((type*)((ap) = ((ap) + sizeof(type))))[-1]) ,因此可能存在冲突的文件,您应首先将其删除以开始清理:

brew

然后,您可以使用sudo rm /usr/local/bin/sbt MacPorts

重新安装

<强> MacPorts的

Homebrew

<强>自制

port install sbt

根据您的环境,您可能需要使用其中任何一个发出brew install sbt 命令。我更喜欢MacPorts,但无论您决定使用哪种都完全是您的偏好。

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

brew