Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

After installing Scala using MacPorts, scala command is not found

Tags:

scala

macports

I am running Snow Leopard 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
like image 455
Hahnemann Avatar asked Oct 08 '11 14:10

Hahnemann


4 Answers

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.

like image 78
Arnost Valicek Avatar answered Oct 16 '22 19:10

Arnost Valicek


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.

like image 27
nezda Avatar answered Oct 16 '22 18:10

nezda


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.

like image 7
Perception Avatar answered Oct 16 '22 18:10

Perception


I think it's:

sudo port select --set scala scala29
like image 2
Michel Charpentier Avatar answered Oct 16 '22 19:10

Michel Charpentier