Skip to content

Installation

This guide will help you install and set up the Onion programming language on your system.

Prerequisites

Onion runs on the JVM and requires:

  • Java Development Kit (JDK) 17 or later
  • SBT (Scala Build Tool) - for building from source

Installation Methods

  1. Download the latest release from the GitHub Releases page
  2. Extract the archive:
    unzip onion-dist.zip
    cd onion-dist
    
  3. Add the bin directory to your PATH:
    export PATH=$PATH:/path/to/onion-dist/bin
    

Method 2: Build from Source

  1. Clone the repository:

    git clone https://github.com/onion-lang/onion.git
    cd onion
    

  2. Build the project with SBT:

    sbt compile
    

  3. Create the distribution package:

    sbt dist
    

This creates a distribution ZIP in target/onion-dist.zip

  1. Or build a standalone JAR:
    sbt assembly
    

This creates onion.jar under the active Scala target directory (currently target/scala-3.3.7/)

  1. Run the local installer if you want shell commands in ~/.local/bin:
    ./install.sh
    

Verify Installation

Check that Onion is installed correctly:

# If using the distribution
onionc --help
onion repl
onion-repl

# If using the JAR directly
java -jar onion.jar --help

IDE Setup

Visual Studio Code

While there's no official Onion extension yet, you can use:

  • Generic syntax highlighting for similar languages
  • Java/Scala extensions for dependency management

IntelliJ IDEA

For developing the Onion compiler itself:

  1. Install the Scala plugin
  2. Import the project as an SBT project
  3. The IDE will automatically download dependencies

Next Steps