Karlo
Karlo

Reputation: 1708

How to create a script to run the jar (while installing SBT)?

I am installing SBT on Mac. I am following the instructions mentioned (cryptically) on the website. I am now at the stage 'Installing sbt manually'. Under 'Unix', it reads:

Put sbt-launch.jar in ~/bin.

Create a script to run the jar, by creating ~/bin/sbt with these contents:

#!/bin/bash
SBT_OPTS="-Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"
java $SBT_OPTS -jar `dirname $0`/sbt-launch.jar "$@"

Make the script executable:

$ chmod u+x ~/bin/sbt

I have put sbt-launch.jar in the correct folder. But I do not understand what the rest means. How can you create the script: in the terminal? Is the code to make the script executable something that you have to execute once in the terminal?

(And after finishing the installation, how will you be able to open SBT?)

Upvotes: 0

Views: 337

Answers (1)

laughedelic
laughedelic

Reputation: 6460

The easiest way for you to install sbt on macOS without much terminal interaction is homebrew. It's a popular package manager and it likely will be useful for you in the future. So just click the link and follow the instruction to install (it's just one command to paste to the terminal). The run

brew install sbt

That's it. Now to launch sbt you just run sbt command in a folder with your projects. Actually, these instructions are on the sbt web-site in the section 'Installing sbt on Mac'.

So if you are following 'Installing sbt manually' on purpose, the "Create a script" part means just to create a "text file" in any editor you use, paste those lines in it, and save to the proper location. Then run chmod command in the terminal. That's it.

About adding something to PATH check this article.

Upvotes: 1

Related Questions