Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cgarst/8d3f6c09bef5ca1c70ad44626d6e57d5 to your computer and use it in GitHub Desktop.
Save cgarst/8d3f6c09bef5ca1c70ad44626d6e57d5 to your computer and use it in GitHub Desktop.

STIG Viewer 3

DISA's STIG Viewer 3 doesn't ship a macOS ARM build, but as an electron app we can port one from the Linux version.

How to Build

Build sqlite3

First build a darwin arm64 sqlite3 binary. That can be built using the command below.

npm install sqlite3 --build-from-source --target_arch=arm64 --fallback-to-build

Build electron app

Pull down the Linux version of STIG Viewer 3 and extract the ZIP.

Check which version of node was used to build the Linux app.

$ strings STIG\ Viewer\ 3| grep 'node.js/v'
node.js/v18.18.2

Download the same version of node for MacOS arm64. Extract this to node-v18.18.2-darwin-arm64 in the Linux app directory.

Next extract Electron's asar file, merge in unpacked files, and copy the sqlite3 binary in.

export PATH="`realpath node-v18.18.2-darwin-arm64/bin`:$PATH"
mkdir patched
npx asar extract resources/app.asar patched
cp -r resources/app.asar.unpacked/* patched
mkdir patched/node_modules/sqlite3-offline-next/binaries/sqlite3-darwin/napi-v3-darwin-arm64/
cp node_sqlite3.node patched/node_modules/sqlite3-offline-next/binaries/sqlite3-darwin/napi-v3-darwin-arm64/

Test the Electron app.

npx electron patched

Build the Electron app.

npx electron-packager patched "STIG Viewer 3" --platform=darwin --arch=arm64 --out=macbuild --overwrite --no-prune

This will produce macbuild/STIG Viewer 3-darwin-arm64/STIG Viewer 3.app.

@loufoss
Copy link

loufoss commented Apr 23, 2025

I had a couple issues

  1. Make sure you have XCode installed "Xcode-select --install" if not done already
  2. I had to run "npm install" after testing the electron app, there were some modules missing
  3. I had to update the version number on some of the modules in package.json file
  4. had a weird issue with the cypress-image-snapshot module which would not upgrade past version 4.0.1
  5. ended up running "npm install --legacy-peer-deps" to get around that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment