Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Old solution that replaces the wrapper app implementation:
- 1. Download and install Azul JDK: https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-macosx_aarch64.dmg
- 2. Download the "All other users" version of ToS: https://www.tdameritrade.com/tools-and-platforms/thinkorswim/desktop/download.html
- 3. Do not unzip it. Instead, run the following commands in a terminal (back up your existing install if you have one!):
- mkdir -p thinkorswim
- cd thinkorswim
- unzip -o ~/Downloads/thinkorswim.zip
- # Just in case to prevent triggering App Translocation
- xattr -r -d com.apple.quarantine .
- mkdir -p thinkorswim.app/Contents/MacOS
- cat >thinkorswim.app/Contents/Info.plist <<'EOF'
- <?xml version="1.0" encoding="UTF-8"?>
- <plist version="1.0">
- <dict>
- <key>CFBundleDisplayName</key>
- <string>Not StreetSmart Edge</string>
- <key>CFBundleName</key>
- <string>thinkorswim</string>
- <key>CFBundleExecutable</key>
- <string>thinkorswim.shim.sh</string>
- </dict>
- </plist>
- EOF
- cat >thinkorswim.app/Contents/MacOS/thinkorswim.shim.sh <<'EOF'
- #!/usr/bin/arch -arm64 /bin/bash
- # Otherwise macOS wants to run it under Rosetta
- set -euo pipefail
- guh() {
- osascript -e "display dialog \"Shim Error: $1\""
- exit 1
- }
- tos="$(dirname $0)/../../.."
- launcher="$tos/launcher.jar"
- # Hardcoded - See below if you want to try newer Java versions
- export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home
- # Key to getting the launcher to not use the bundled JVM
- export INSTALL4J_JAVA_HOME_OVERRIDE="$JAVA_HOME"
- if [[ ! -d "$JAVA_HOME" ]]; then
- guh "JAVA_HOME is set to $JAVA_HOME which doesn't exist"
- fi
- if [[ ! -e "$launcher" ]]; then
- guh "$launcher doesn't exist"
- fi
- # ToS reads suits.properties from cwd
- cd "$tos"
- vmoptions=()
- while IFS= read -r option; do
- if [[ ! "$option" =~ "classpath" ]]; then
- vmoptions+=("$option")
- fi
- done <"$tos/thinkorswim.vmoptions"
- # On newer Java versions, --illegal-access=permit no longer has any effect. YMMV:
- #
- # --add-opens=java.base/sun.security.util=ALL-UNNAMED
- # --add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED
- # --add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED
- # --add-opens=java.desktop/com.apple.eawt=ALL-UNNAMED
- # --add-opens=java.xml/com.sun.org.apache.xml.internal.utils=ALL-UNNAMED
- # --add-opens=java.desktop/javax.swing=ALL-UNNAMED
- exec "$JAVA_HOME/bin/java" "${vmoptions[@]}" "-jar" "$launcher"
- EOF
- chmod +x thinkorswim.app/Contents/MacOS/thinkorswim.shim.sh
- # Run it (or just double click in Finder)
- open ./thinkorswim.app
- To run, just double click the shim app in Finder. The shim app is needed since that's what ToS uses to re-launch itself after updates. Note that macOS [really wants](https://apple.stackexchange.com/questions/452070/custom-macos-application-bundle-requires-rosetta-even-through-it-shouldnt) to execute shell script apps inside Rosetta, so you will be prompted to install it. However, ToS will not be executed inside Rosetta, and you can confirm this in Activity Monitor.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement