Skip to content

Instantly share code, notes, and snippets.

@cuber
Created April 25, 2014 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cuber/11292869 to your computer and use it in GitHub Desktop.
Save cuber/11292869 to your computer and use it in GitHub Desktop.
How To install Scala 2.10 with homebrew
# you should checkout to the history version of scala.rb
cd /path/to/homebrew (default is /usr/local)
git checkout d64edec425df44918c58b6b021ffef2628242248 Library/Formula/scala.rb
brew info scala # you will see the 2.10 version
brew install scala
# after install, turn back to the master version
brew checkout master Library/Formula/scala.rb
# you can install both 2.10 & 2.11, brew switch can easily switch to any specific version
brew switch scala 2.10
brew switch scala 2.11
@kenbod
Copy link

kenbod commented Oct 3, 2015

Thank you! This saved my bacon today.

Couple of notes:

After step 4, insert a new step which says: brew unlink scala. This allows the install command to proceed. You only need this if you already had Scala 2.11.x installed.

Typo in step 7: Change brew to git

Finally, for the last two switch commands, my version of homebrew requires specific version numbers... i.e. brew switch scala 2.10.4. So perhaps update the last two commands to read 2.10.x and 2.11.x.

Anyway, thanks for documenting this!

@skate056
Copy link

skate056 commented Feb 8, 2016

I cannot execute #3. It gives me an error that the reference is not a tree.

local (master) $ git checkout d64edec425df44918c58b6b021ffef2628242248 Library/Formula/scala.rb
fatal: reference is not a tree: d64edec425df44918c58b6b021ffef2628242248

I just installed homebrew and the history is only 2 days old. Not sure if that is causing the error.

@vtatai
Copy link

vtatai commented May 25, 2016

git fetch --unshallow solved it for me.

@kenbod
Copy link

kenbod commented Nov 11, 2016

Note: the original code above no longer works. The formula for scala.rb is no longer located in $HOMEBREW/Library/Formula/

@kenbod
Copy link

kenbod commented Nov 11, 2016

I found a solution here: https://github.com/ofishel/hb-scala-2.10.4

brew install homebrew/versions/scala210
brew unlink scala
brew link scala210 --force

@fan-mingchun
Copy link

brew install homebrew/versions/scala210 would install 2.10.6. I just try

@JosephMRally
Copy link

this no longer works with brew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment