🎯 Executive Summary
Today I successfully installed Scala 3.8.4 on my Debian system using Coursier, the official Scala installer. I ran into some PATH issues along the way, but I resolved them by manually adding the correct Coursier binary directory to my ~/.bashrc. After that, I validated everything by testing 18+ Scala 3 features right in the REPL. Here’s my full journey.
📋 My Installation Timeline
Phase 1: Initial Attempt
- What I tried:
scala -version - What happened:
bash: scala: command not found - Why: No Scala or Coursier installed on my system yet
Phase 2: Downloading Coursier
- What I ran:bashcurl -fL “https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz” | gzip -d > cs chmod +x cs
- Result: ✅ Downloaded successfully, made it executable
Phase 3: Running Coursier Setup
- What I ran:
./cs setup - What happened:
- Detected my JVM at
/usr/lib/jvm/java-26-amazon-corretto - Asked if I wanted to add
~/.local/share/coursier/binto PATH - I answered
y(yes)
- Detected my JVM at
- Tools installed: ammonite, cs, coursier, scala, scalac, scala-cli, sbt, sbtn, scalafmt
Phase 4: Fixing the PATH Issue
- The problem: Even after setup,
scalawasn’t recognized - The fix: I manually added the path to my
~/.bashrcbashecho ‘export PATH=”$HOME/.local/share/coursier/bin:$PATH”‘ >> ~/.bashrc source ~/.bashrc - Why: The setup script added it to
~/.profile, but I was using~/.bashrc
Phase 5: Verification
- What I ran:
scala -version - Output:textScala code runner version: 1.14.0 Scala version (default): 3.8.4
- Result: ✅ Finally working!
Phase 6: REPL Testing
I spent time in the REPL testing all the key Scala 3 features. Everything worked beautifully (aside from some harmless Java warnings).
💻 My Final Working Setup
| Component | Version | Status |
|---|---|---|
| Scala | 3.8.4 | ✅ Installed |
| JVM | 26.0.2.1 (Amazon Corretto) | ✅ Detected |
| Coursier | Latest | ✅ Installed |
| sbt | Latest | ✅ Installed |
| Scala CLI | Latest | ✅ Installed |
| scalafmt | Latest | ✅ Installed |
| Ammonite | Latest | ✅ Installed |
| OS | Debian | ✅ Compatible |
🚀 My Recommended Way Forward
What I’m Doing Next
1. Creating My First Project
bash
# Using sbt template (my preferred approach) sbt new scala/scala3.g8 cd your-project-name sbt run
2. Setting Up My IDE
VS Code with Metals (my recommendation):
- Install VS Code
- Install the Metals extension
- Open my project folder
Alternative: IntelliJ IDEA:
- Download IntelliJ IDEA Community Edition
- Install Scala plugin
- Import the sbt project
3. My Learning Routine
bash
# Daily practice - 15-20 minutes in REPL scala # Start the REPL :load script.scala # Load and test my scripts :quit # Exit when done
🏷️ My Scala 3 Quick Reference
Category: Modern JVM Language
Tags: Functional Programming Object-Oriented JVM Type-Safe Multi-Paradigm Scala 3 Dotty
📸 My Favorite Code Snippets
scala
// Scala 3 Highlights - What I Learned Today // =========================================== // 1. Enums (Algebraic Data Types) - Much cleaner than Scala 2! enum Color: case Red, Green, Blue case Custom(hex: String) // 2. Extension Methods - Finally! No more implicit classes! extension (n: Int) def squared: Int = n * n def isEven: Boolean = n % 2 == 0 // 3. Union Types - This blew my mind! def process(x: Int | String): String = x match case i: Int => s"Number: $i" case s: String => s"Text: $s" // 4. Context Abstractions - Cleaner than implicits trait Show[T]: extension (t: T) def show: String given Show[Int] with extension (i: Int) def show: String = s"Int($i)" // 5. Intersection Types - Like trait mixing on steroids trait Flyable: def fly(): String = "Flying!" trait Swimmable: def swim(): String = "Swimming!" class Duck extends Flyable, Swimmable // 6. Functional Collections - Where Scala shines val nums = (1 to 10).toList val evens = nums.filter(_ % 2 == 0) val squares = nums.map(_.squared) val total = nums.foldLeft(0)(_ + _) // 7. Pattern Matching - So powerful! def describe(c: Color): String = c match case Color.Red => "Stop!" case Color.Green => "Go!" case Color.Blue => "Relax" case Color.Custom(hex) => s"Custom: $hex" // My test runs: println(5.squared) // 25 - works! println(process(42)) // Number: 42 println(describe(Color.Red)) // Stop! println(Duck().fly()) // Flying!
📚 My Learning Roadmap
Week 1: The Basics
- □ Basic syntax and expressions
- □ Functions and methods
- □ Collections (List, Map, Option)
- □ Pattern matching
- □ Case classes
Week 2: Scala 3 Features
- □ Enums and ADTs
- □ Extension methods (my new favorite!)
- □ Given/Using (contextual abstractions)
- □ Union/Intersection types
- □ Opaque types (privacy without overhead)
Week 3: Functional Programming
- □ Immutability and pure functions
- □ Higher-order functions
- □ Type classes
- □ Monads (Option, Either, Try)
- □ For-comprehensions
Week 4: Building Projects
- □ sbt build configuration
- □ Testing with ScalaTest
- □ Error handling properly
- □ Basic CLI application
- □ Working with files
🔧 My Handy Commands Reference
bash
# Environment Commands scala -version # Check my Scala version scalac -version # Check compiler version cs list # List all my installed tools cs install scala # Install/update Scala sbt --version # Check sbt version # REPL Commands scala # Start REPL :help # Show all REPL commands :quit # Exit REPL :type <expr> # Show expression type :load <file> # Load a Scala file # Project Commands sbt new scala/scala3.g8 # Create a new project sbt compile # Compile my project sbt test # Run my tests sbt run # Run my main class sbt package # Create a JAR file # Scala CLI scala-cli run file.scala # Run a script scala-cli repl # Start REPL scala-cli compile file.scala # Compile a file
✅ What I Accomplished Today
- ☑ Installed Coursier on my Debian system
- ☑ Successfully installed Scala 3.8.4
- ☑ Configured PATH for permanent access
- ☑ Verified installation with
scala -version - ☑ Tested Scala REPL
- ☑ Ran basic operations in REPL
- ☑ Explored Enums
- ☑ Tested Extension Methods
- ☑ Implemented Given/Using (type classes)
- ☑ Tried Union & Intersection types
- ☑ Verified sbt installation
- ☑ Validated Scala CLI installation
📊 My System Status
text
✅ Scala 3.8.4 ── Installed and working ✅ Coursier ── Package manager ready ✅ sbt ── Build tool ready ✅ Scala CLI ── Scripting ready ✅ JVM 26 ── Java runtime ready ✅ REPL ── Interactive playground active ✅ PATH ── Permanently configured ✅ .bashrc ── Updated with Scala path
🎉 My Final Verdict
Status: ✅ Production-Ready!
My Debian system is now fully equipped with a working Scala 3 development environment. All tools are installed, PATH is correctly configured, and I’ve already tested the REPL with major language features.
My Next Action: Creating my first project with sbt new scala/scala3.g8 and starting to build something!
Questions I Still Have? I’ll keep this chat handy for:
- Project setup guidance
- Learning specific features
- Troubleshooting any new issues
- Best practices advice
- Library recommendations
Time to start coding with Scala 3! 🚀