Skip to content

Instantly share code, notes, and snippets.

@WebReflection
Last active October 2, 2024 23:49
Show Gist options
  • Save WebReflection/35e61b9dbb4987e288f256aae73b3a5c to your computer and use it in GitHub Desktop.
Save WebReflection/35e61b9dbb4987e288f256aae73b3a5c to your computer and use it in GitHub Desktop.
JavaScriptCore for macOS and Linux
#!/usr/bin/env bash
if [ -f /usr/lib/jsc ]; then
/usr/lib/jsc "$@"
elif [ -f /System/Library/Frameworks/JavaScriptCore.framework/Resources/jsc ]; then
/System/Library/Frameworks/JavaScriptCore.framework/Resources/jsc "$@"
fi
@WebReflection
Copy link
Author

WebReflection commented Feb 6, 2018

To make it an executable:

curl -LO https://gist.githubusercontent.com/WebReflection/35e61b9dbb4987e288f256aae73b3a5c/raw/ebb8bdf763b80ff52e3b81e49592ded12a488c18/jsc
chmod a+x jsc
sudo mv jsc /usr/local/bin/

@LeetCodes
Copy link

how is this for Linux?

@WebReflection
Copy link
Author

@LeetCodes it's JavaScriptCore provided by GNOME Web, so it's yet another JS interpreter you can use from console.
Did I answer your question?

@DavidBuchanan314
Copy link

DavidBuchanan314 commented Oct 2, 2024

I have the same question, and it doesn't answer it - the paths given are macOS-specific

Edit: answer: https://trac.webkit.org/wiki/JSCOnly

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