Advertisement
iplaydeadgames

Untitled

Oct 14th, 2023
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.59 KB | None | 0 0
  1. Old solution that replaces the wrapper app implementation:
  2.  
  3. 1. Download and install Azul JDK: https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-macosx_aarch64.dmg
  4. 2. Download the "All other users" version of ToS: https://www.tdameritrade.com/tools-and-platforms/thinkorswim/desktop/download.html
  5. 3. Do not unzip it. Instead, run the following commands in a terminal (back up your existing install if you have one!):
  6.  
  7.  
  8. mkdir -p thinkorswim
  9. cd thinkorswim
  10.  
  11. unzip -o ~/Downloads/thinkorswim.zip
  12.  
  13. # Just in case to prevent triggering App Translocation
  14. xattr -r -d com.apple.quarantine .
  15.  
  16. mkdir -p thinkorswim.app/Contents/MacOS
  17.  
  18. cat >thinkorswim.app/Contents/Info.plist <<'EOF'
  19. <?xml version="1.0" encoding="UTF-8"?>
  20. <plist version="1.0">
  21. <dict>
  22. <key>CFBundleDisplayName</key>
  23. <string>Not StreetSmart Edge</string>
  24. <key>CFBundleName</key>
  25. <string>thinkorswim</string>
  26. <key>CFBundleExecutable</key>
  27. <string>thinkorswim.shim.sh</string>
  28. </dict>
  29. </plist>
  30. EOF
  31.  
  32. cat >thinkorswim.app/Contents/MacOS/thinkorswim.shim.sh <<'EOF'
  33. #!/usr/bin/arch -arm64 /bin/bash
  34. # Otherwise macOS wants to run it under Rosetta
  35.  
  36. set -euo pipefail
  37.  
  38. guh() {
  39. osascript -e "display dialog \"Shim Error: $1\""
  40. exit 1
  41. }
  42.  
  43. tos="$(dirname $0)/../../.."
  44. launcher="$tos/launcher.jar"
  45.  
  46. # Hardcoded - See below if you want to try newer Java versions
  47. export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home
  48.  
  49. # Key to getting the launcher to not use the bundled JVM
  50. export INSTALL4J_JAVA_HOME_OVERRIDE="$JAVA_HOME"
  51.  
  52. if [[ ! -d "$JAVA_HOME" ]]; then
  53. guh "JAVA_HOME is set to $JAVA_HOME which doesn't exist"
  54. fi
  55.  
  56. if [[ ! -e "$launcher" ]]; then
  57. guh "$launcher doesn't exist"
  58. fi
  59.  
  60. # ToS reads suits.properties from cwd
  61. cd "$tos"
  62.  
  63. vmoptions=()
  64. while IFS= read -r option; do
  65. if [[ ! "$option" =~ "classpath" ]]; then
  66. vmoptions+=("$option")
  67. fi
  68. done <"$tos/thinkorswim.vmoptions"
  69.  
  70. # On newer Java versions, --illegal-access=permit no longer has any effect. YMMV:
  71. #
  72. # --add-opens=java.base/sun.security.util=ALL-UNNAMED
  73. # --add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED
  74. # --add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED
  75. # --add-opens=java.desktop/com.apple.eawt=ALL-UNNAMED
  76. # --add-opens=java.xml/com.sun.org.apache.xml.internal.utils=ALL-UNNAMED
  77. # --add-opens=java.desktop/javax.swing=ALL-UNNAMED
  78. exec "$JAVA_HOME/bin/java" "${vmoptions[@]}" "-jar" "$launcher"
  79. EOF
  80.  
  81. chmod +x thinkorswim.app/Contents/MacOS/thinkorswim.shim.sh
  82.  
  83. # Run it (or just double click in Finder)
  84. open ./thinkorswim.app
  85.  
  86.  
  87. 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