Hahnemann
Hahnemann

Reputation: 4678

After installing Scala using MacPorts, scala command is not found

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

Upvotes: 21

Views: 4923

Answers (4)

nezda
nezda

Reputation: 173

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.

Upvotes: 8

Perception
Perception

Reputation: 80633

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.

Upvotes: 7

Arnost Valicek
Arnost Valicek

Reputation: 2478

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.

Upvotes: 52

Michel Charpentier
Michel Charpentier

Reputation: 21

I think it's:

sudo port select --set scala scala29

Upvotes: 2

Related Questions