lunduniversity / introprog

Teaching material for "Introduction to Programming using Scala" at Lund University, LTH. http://cs.lth.se/pgk/
144 stars 181 forks source link

update course page https://cs.lth.se/pgk/verktyg/ #557

Closed theolundqvist closed 2 years ago

theolundqvist commented 3 years ago
  1. Install brew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Install Scala 3 brew install lampepfl/brew/dotty
  3. If Scala 2 is already installed, unlink it brew unlink scala brew link dotty

Såklart måste Java, sbt, scala metals laddas ner som tidigare

fritjof-b commented 3 years ago

Note that (at least recently) installing Scala 3 will fail if you're using a Mac with the new Apple Silicon chip. See #524

bjornregnell commented 3 years ago

@theolundqvist If you don't have java, won't brew install it as a dependency? Which version will you get then? (I suspect Java 8, and I would prefer 11). How to install openjdk 11 with brew om mac? Can you two @theolundqvist @fritjof-b investigate if it is possible to give a series of commands that will work on any macos (intel or arm) with openjdk11 and Scala 3?

theolundqvist commented 3 years ago

@bjornregnell brew install openjdk@8 for openjdk 8 brew install openjdk@11 for openjdk 11 brew install --cask adoptopenjdk for the latest (16).

@fritjof-b You mentioned in #524 that openjdk11 is available for M1 macbooks through brew. Any alterations needed to the command brew install openjdk@11?

fritjof-b commented 3 years ago

I believe the problems stems from the following file https://github.com/lampepfl/homebrew-brew/blob/master/dotty.rb (adoptopenJDK is not available for M1 yet).

There are releases of Java for the M1 chip. What I did was

brew install --ignore-dependencies lampepfl/brew/dotty

and then installing Java manually, but if I remember correctly you then have to fix your PATH etc...

Edit: I'm currently running adoptopenjdk@11, the problem was that even when I had it installed, running

brew install lampepfl/brew/dotty

would try to install adoptopenjdk@8, which is not available for M1, which then leads to the installation failing.

bjornregnell commented 3 years ago

We need a "naked" M1 to test full instructions from scratch on. @fritjof-b When you have time and if you don't think it is too disturbing for your working environment; could you perhaps (if I understood it correct that you have an M1) uninstall scala/java and give it a try, eventually?

bjornregnell commented 3 years ago

Or we just wait a bit until Apple has its M1 stuff up to date with modern tech ;)

fritjof-b commented 3 years ago

@bjornregnell @theolundqvist Yes, I'll try when possible. Will post steps here.

bjornregnell commented 3 years ago

@theolundqvist @fritjof-b I have made new instructions for getting scala in terminal here: https://cs.lth.se/pgk/verktyg/ I have resorted to manual install in /usr/local/bin to be on the safe side, as there probably will not be any official install by the course start... Could you test those instructions on macos after uninstalling your scala 2 and scala 3 if you have them (using brew I suppose)? (or test on another machine if you have access to another clean mac). If you dont uninstall I guess the brew stuff are earlier on your path than /usr/local/bin (which is one reason to choose that). Please also verify that /usr/local/bin is in the file /etc/paths and/or in echo $PATH

fritjof-b commented 3 years ago

@bjornregnell will take a look at this now

fritjof-b commented 3 years ago

@bjornregnell Installing scala worked by following the steps in the guide.

Installing sbt fails when running natively on Mac M1...

(base) ➜  scala brew install sbt@1
sbt: The x86_64 architecture is required for this software.
Error: An unsatisfied requirement failed this build.

This is the same problem as just trying to install scala3 using brew install. To get around this one could do

curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk install sbt

(We can specify version after sbt if we want)

bjornregnell commented 3 years ago

Ok many thanks. How to specify version with sdkman? We need at least 1.5.2 but preferably the latest 1.5.5. What version does just sdk install sbt give?

fritjof-b commented 3 years ago

When I ran sdk install sbt it installed 1.5.5, so I presume it intalls the latest. You could also do sdk install sbt 1.5.2, for example.

bjornregnell commented 3 years ago

Good! It should always be the latest. Do you want to do a PR on the tools page or do you prefer that I do the update? https://github.com/lunduniversity/introprog/blob/master/web/tools/tools.md

bjornregnell commented 3 years ago

i mean skip brew in favour of sdkman

fritjof-b commented 3 years ago

I can take care of it today. So just to be clear - we will skip brew entirely for now and use sdkman; we want a guide that only contain native stuff e.g. curl and use package manager sdkman?

bjornregnell commented 3 years ago

Great if you can look into this today. Yes - sdkman instead of brew if that works for both m1 and intel macos?

bjornregnell commented 3 years ago

We don't change the stuff for linux but make special stuff for macos.

bjornregnell commented 2 years ago

https://cs.lth.se/pgk/verktyg/

bjornregnell commented 2 years ago

fixed. see discussion on discord.