7

I'm trying to install scala on my mac (Maverick). I downloaded and unarchived it. I then put myself from where it was unarchived and inside the /bin folder in the terminal. But when I run "scala" or "scalac" I get :

-bash: scala: command not found

Why?

Chris Martin
  • 30,334
  • 10
  • 78
  • 137
Paul Boosz
  • 71
  • 1
  • 1
  • 2
  • 3
    have you tried `./scala` instead of `scala` – chiliNUT Sep 28 '15 at 06:02
  • Also have you verified that the downloaded archive was for mac and not for win or linux. – Pablo Jomer Sep 28 '15 at 06:03
  • `sbt console` may be a useful alternative; see [what-is-the-difference-of-running-scala-and-sbt-console](https://stackoverflow.com/questions/27192398/what-is-the-difference-of-running-scala-and-sbt-console) – Ricardo Apr 29 '22 at 01:25

3 Answers3

12

I always suggest that mac users install homebrew and use homebrew as their primary package installer to install software.

Installing scala is as simple as

brew install scala

Homebrew will also install/fix java dependencies for you and handle path issues (I believe)

Zee
  • 1,321
  • 2
  • 18
  • 41
  • 2
    Also, for anyone using homebrew to fix scala issues, if you're also getting a "bash command not found" error for the `sbt` command after running `brew install scala`, you can try running `brew upgrade sbt` afterwards. – Dascienz Nov 14 '18 at 00:35
4

I get the same issue and quickly I found everything is fine, if you write the correct path into your .bash_profile.

The only thing you need is to close current terminal and open a new one, on which Scala would work.

Hope this work for you.

QIAN KEQIAO
  • 541
  • 1
  • 4
  • 7
2

do you have Java installed and available on your PATH http://sourabhbajaj.com/mac-setup/Java/README.html the same author also provides good Scala / SBT setup info http://sourabhbajaj.com/mac-setup/Java/README.html

ozOli
  • 1,414
  • 1
  • 18
  • 26