After installing Scala using MacPorts, scala command is not found
I am running Snow Le开发者_StackOverflow中文版opard and installed MacPorts. I then installed the latest (as of this writing) Scala version as:
$ sudo port install scala29
What to do after this? When I try to execute the Scala interpreter, I get:
-bash: scala: command not found
I'm using MacPorts 2.1.2 and things seems to changed a bit again.
$ sudo port select --list scala
Shows
Available versions for scala:
none (active)
scala2.9
Command suggested by nezda does not work properly: $ sudo port select --set scala2.9
gives error
Error: The 'set' command expects two arguments: <group>, <version>
But following helps
$ sudo port select --set scala scala2.9
Activates Scala 2.9
Selecting 'scala2.9' for 'scala' succeeded. 'scala2.9' is now active.
Checking scala again
$ sudo port select --list scala
Available versions for scala:
none
scala2.9 (active)
And I can run Scala now.
This seems to have changed. On Lion + MacPorts 2.1.1, I had to do the following:
Verify this shows the version:
sudo port select --list scala
Mine showed:
Available versions for scala: none (active) scala29
If it is not selected, you can use this command to select it:
sudo port select --set scala scala29
Open a new terminal (ensuring $PATH
is up to date) and verify scala
is now 2.9.x.
Okay, so I actually had to search this since the Scala install has changed since the last time I did it. The executables should have been linked from /opt/local/bin, to use them without prefixing the folders do this:
cd /opt/local/bin
sudo scala_select scala29
Now you should be able to run the scala command from any directory.
As of January 2013 this answer is outdated, Arnost Valicek's answer is known to work.
I think it's:
sudo port select --set scala scala29
精彩评论