Contents
Module 0: Setup
Lets get Slug installed and ready to run. Pick one path below.
Option A: Download a precompiled binary
- Download the latest release from the Slug releases page.
- Extract the archive and locate the
slugbinary. - Add it to your
PATHand setSLUG_HOME(see Local setup below).
macOS note
If you are on macOS, remove quarantine and apply an ad-hoc signature:
xattr -d com.apple.quarantine ./bin/slug
codesign -s - --deep --force ./bin/slug
What these do:
xattr -d com.apple.quarantine ./bin/slugremoves the download quarantine so the binary can run.codesign -s - --deep --force ./bin/slugadds an ad-hoc signature so Gatekeeper is satisfied.
Option B: Build from source
If you have Go installed:
git clone https://github.com/babyman/slug-lang.git
cd slug-lang
make build
Local setup
Once you have a slug binary, export SLUG_HOME and add the binary to your PATH:
export SLUG_HOME=[[path to slug home directory]]
export PATH="$SLUG_HOME/bin:$PATH"
SLUG_HOME is where Slug looks for libraries.
Try it
Open a new terminal, run slug --version, and confirm it prints a version.
Troubleshooting
If something is not working, check these first:
slug: command not found: make surePATHincludes$SLUG_HOME/bin.SLUG_HOMEnot set: export it and open a new terminal.- macOS “cannot be opened” or “not signed”: re-run the
xattrandcodesigncommands above. - Imports failing: confirm
SLUG_HOME/libexists and your--rootis correct.
Sublime Text syntax highlighting
If you use Sublime Text, install Slug Syntax Highlighting by placing the package in your Packages/User directory.
Module 0.1: Running Slug
This is your quick-start cheat sheet for running programs.
Lesson 0.1: Shell scripts
You can run Slug files as scripts if slug is on your PATH:
#!/usr/bin/env slug
println("Hello Slug!")
Lesson 0.2: CLI usage
slug --root [path to module root] script[.slug] [args...]
--rootsets the module root for imports.scriptcan be a file path or a module name.- extra tokens become program arguments.
Lesson 0.3: REPL
Stay tuned for this feature.