Ocular is installed via the ShiftLeft CLI. Follow these steps to get started:

Step 1: Install the ShiftLeft CLI

curl >/usr/local/bin/sl && chmod a+rx /usr/local/bin/sl

Step 2: Authenticate with your ShiftLeft account

Create an environment variable called SHIFTLEFT_ACCESS_TOKEN and set its value to your access token (your access token is available in the Dashboard).

Alternatively, you can run the following, which will also create a configuration file located at .shiftleft\config.json:

sl auth --org "${ORGANISATION_ID}" --token "${ACCESS_TOKEN}"

Step 3: Download Ocular

sl ocular

Step 4: Run Ocular

Use the same ShiftLeft CLI command to run Ocular:

sl ocular

Ocular requires Java Runtime Environment 8 (or later) to run.

If your default java is JDK8 (check with java -version) and you want to scan C code, you need to have an environment variable JAVA_11_HOME that points to a JDK11. Otherwise, you need to have an environment variable JAVA_8_HOME that points to a JDK8. In doubt, just use ocular and follow the instructions in the error messages.

Background: some components (specifically java2cpg) require Java 8 (exactly, not higher), while others (specifically c2cpg) require Java >= 9.