# New School 99 log collector for Mac, version 1 (2026-11-21). Guide: https://newschool99.com/help/logs # It READS New School 99's own files and the crash reports macOS keeps for the game, hides private details, # and writes ONE zip file on your Desktop. It sends nothing anywhere and changes nothing else on your Mac. # You decide whether to post that zip in #bug-reports on the New School 99 Discord. ( set -u export LC_ALL=C ver=1 days=30 home_dir="${HOME%/}" lad="$home_dir/Library/Application Support/New School 99" ns="$home_dir/.newschool99" dk="$home_dir/.darkanrs" diag_dir="$home_dir/Library/Logs/DiagnosticReports" now_stamp=$(date "+%Y-%m-%d-%H%M") now_human=$(date "+%Y-%m-%d %H:%M") now_tz=$(date "+%z") zip_name="NS99-logs-${now_stamp}.zip" tmp_dir=$(mktemp -d "${TMPDIR:-/tmp}/ns99-logs.XXXXXX") || { echo "Could not create a temporary folder. Please send your logs by hand: https://newschool99.com/help/logs#by-hand" >&2 exit 1 } stage="$tmp_dir/stage" mkdir -p "$stage" out_partial="" cleanup() { rm -rf "$tmp_dir"; [ -n "${out_partial:-}" ] && rm -f "$out_partial"; } trap cleanup EXIT HUP INT TERM # Names read ONLY so we can hide them in every collected text file; never copied into the zip. hide_users="$tmp_dir/hide_users.txt" hide_macs="$tmp_dir/hide_macs.txt" hide_accts="$tmp_dir/hide_accts.txt" : > "$hide_users" : > "$hide_macs" : > "$hide_accts" add_hide() { [ -n "${2:-}" ] && printf '%s\n' "$2" >> "$1" } add_hide "$hide_users" "${USER:-}" add_hide "$hide_users" "${LOGNAME:-}" if command -v id >/dev/null 2>&1; then add_hide "$hide_users" "$(id -un 2>/dev/null || true)" add_hide "$hide_users" "$(id -F 2>/dev/null || true)" fi if command -v scutil >/dev/null 2>&1; then for key in ComputerName LocalHostName HostName; do val=$(scutil --get "$key" 2>/dev/null || true) if [ -n "$val" ]; then add_hide "$hide_macs" "$val" case "$val" in *.*) add_hide "$hide_macs" "${val%%.*}" ;; esac fi done fi if command -v hostname >/dev/null 2>&1; then hn=$(hostname 2>/dev/null || true) if [ -n "$hn" ]; then add_hide "$hide_macs" "$hn" case "$hn" in *.*) add_hide "$hide_macs" "${hn%%.*}" ;; esac fi fi # Remembered game login name (read only to hide it; update-login.properties is never copied into the zip). for uf in "$ns/update-login.properties" "$dk/update-login.properties"; do if [ -f "$uf" ] && [ -r "$uf" ]; then acct=$(awk -F'[=:]' '/^[[:space:]]*username[[:space:]]*[=:]/ { sub(/^[[:space:]]*username[[:space:]]*[=:][[:space:]]*/, ""); gsub(/\\(.)/, "\\1"); print; exit }' "$uf" 2>/dev/null || true) add_hide "$hide_accts" "$acct" fi done if command -v defaults >/dev/null 2>&1; then pref_acct=$(defaults read com.apple.java.util.prefs "/com/darkan/newschool99/pregame" 2>/dev/null | awk -F'"' '/username/ { print $4; exit }' || true) add_hide "$hide_accts" "$pref_acct" fi # Reads one file (capped at first 200 KB + last 2.5 MB), trims hs_err or macOS crash reports when asked, # and scrubs private details (paths, names, login, emails, IPs, tokens). scrub_file() { src="$1" dst="$2" mode="${3:-plain}" mkdir -p "$(dirname "$dst")" if command -v perl >/dev/null 2>&1; then NS99_HOME="$home_dir" NS99_USERS="$hide_users" NS99_MACS="$hide_macs" NS99_ACCTS="$hide_accts" NS99_MODE="$mode" \ perl -e ' use strict; use warnings; my ($src, $dst) = @ARGV; my $mode = $ENV{NS99_MODE} || "plain"; my $home = $ENV{NS99_HOME} || ""; my $head_n = 200000; my $tail_n = 2500000; open(my $fh, "<:raw", $src) or exit 1; my $size = -s $fh; my $raw = ""; if (!defined $size || $size <= $head_n + $tail_n) { local $/; $raw = <$fh>; $raw = "" unless defined $raw; } else { read($fh, my $h, $head_n); seek($fh, $size - $tail_n, 0); read($fh, my $t, $tail_n); my $cut = $size - $head_n - $tail_n; $raw = $h . "\n...[cut $cut bytes]...\n" . $t; } close($fh); $raw =~ s/^\xEF\xBB\xBF//; if ($mode eq "macreport") { $raw =~ s/"(?:crashReporterKey|sleepWakeUUID|bootSessionUUID|deviceIdentifierForVendor)"\s*:\s*"[^"]*"\s*,?//g; $raw =~ s/^(Anonymous UUID|Sleep\/Wake UUID):.*$/$1: (removed)/mg; $raw =~ s{("path"\s*:\s*")((?:[^"\\]|\\.)*)(")}{ my ($a, $p, $c) = ($1, $2, $3); $p =~ s{\\/}{/}g; $p =~ s{/$}{}; $p =~ s{^.*/}{}; $a . $p . $c; }ge; $raw =~ s{^(\s*0x[0-9a-fA-F]+\s+-\s+0x[0-9a-fA-F]+\s+.*?)\s(/\S.*)$}{ my ($a, $p) = ($1, $2); $p =~ s{/$}{}; $p =~ s{^.*/}{}; $a . " " . $p; }mge; } elsif ($mode eq "hs" || $raw =~ /^(?:A fatal error has been detected|#\s*A fatal error|Register to memory mapping|Stack slot to memory mapping|Top of Stack|Instructions)/im) { $raw =~ s/^Environment Variables:.*?(?:\r?\n[ \t]*\r?\n|\z)/Environment Variables: (removed)\n\n/ms; $raw =~ s/^Register to memory mapping:.*?(?=^-{10,}\s+P R O C E S S|\z)/Register to memory mapping, top of stack, instructions: (removed)\n\n/ms; $raw =~ s/^(Top of Stack|Instructions|Stack slot to memory mapping):.*?(?=^\r?$)/$1: (removed)/gms; $raw =~ s{^(0x[0-9a-f]+\s+-\s+0x[0-9a-f]+\s+)(/\S.*)$}{ my ($a, $p) = ($1, $2); if ($p =~ m{^/(?:System|usr/lib)/|New ?School ?99|newschool99|\.newschool99|darkan|/jdk|/jre|/runtime/|/java\b}i) { $a . $p; } else { $p =~ s{^.*/}{}; $a . $p; } }mige; } # Strip ANSI colour escapes $raw =~ s/\x1B\[[0-9;?]*[ -\/]*[@-~]//g; # Hide home folder and any /Users/ path (except /Users/Shared) $home =~ s{/$}{}; if (length($home) > 3) { for my $sp ($home, do { my $x = $home; $x =~ s{/}{\\/}g; $x }, do { my $x = $home; $x =~ s{/}{%2F}g; $x }, do { my $x = $home; $x =~ s{ }{%20}g; $x }) { my $q = quotemeta($sp); $raw =~ s/$q/~/gi; } } my $sl = qr{(?:\\?/|%2F)}i; $raw =~ s{${sl}Users${sl}+(?!Shared(?![^\\\/%\s"'\'']))(?:(?!%2F)[^\\\/\s"'\''<>|:*?])+}{~}gi; # Hide user names, Mac names and remembered game login my %hide; my @pairs = ([$ENV{NS99_USERS}, ""], [$ENV{NS99_MACS}, ""], [$ENV{NS99_ACCTS}, ""]); for my $pair (@pairs) { my ($f, $rep) = @$pair; next unless defined $f && -r $f; open(my $hf, "<", $f) or next; while (my $line = <$hf>) { $line =~ s/^\s+|\s+$//g; next if length($line) < 3; $hide{$line} = $rep unless exists $hide{$line}; } close($hf); } for my $k (sort { length($b) <=> length($a) } keys %hide) { my $p = quotemeta($k); $p =~ s/\\ |_/[ _]/g; $raw =~ s/(?$2/g; $raw =~ s/^(\[Combat\] auto-play .+? on ).+$/$1/mg; $raw =~ s/(?/g; my $ipv4 = qr{(?"}ge; $raw =~ s/(?/gi; $raw =~ s/(?/gi; $raw =~ s/\b(\w*(?:password|passwd|token|secret)\w*|pwd|api[_-]?key|session[_-]?(?:id|key)|cookie)\b(["'\'']?\s*[=:]\s*)("[^"]*"|'\''[^'\'']*'\''|\S+)/$1$2/gi; $raw =~ s/--?\w*(?:token|password|secret|key)\w*\s+\S+//gi; $raw =~ s/\b(bearer|basic)\s+\S{8,}/$1 /gi; $raw =~ s/(--ns99-relaunch=|ns99\.launcher\.relaunch=)\S*(?: [^\s=:\\\/]+)*/$1/g; open(my $out, ">:raw", $dst) or exit 1; print $out $raw; close($out); ' "$src" "$dst" else # Fallback when perl is absent: cap bytes and scrub paths, emails, IPs and secrets with POSIX tools. sz=$(wc -c < "$src" | tr -d ' ') if [ "$sz" -le 2700000 ]; then cat "$src" else head -c 200000 "$src" printf '\n...[cut %s bytes]...\n' "$((sz - 2700000))" tail -c 2500000 "$src" fi | sed -E \ -e "s|${home_dir}|~|g" \ -e 's|/Users/[^/"'"'"'[:space:]]+|~|g' \ -e 's/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}//g' \ -e 's/([Pp]assword|[Pp]asswd|[Tt]oken|[Ss]ecret|[Cc]ookie)([[:space:]]*[=:][[:space:]]*)[^[:space:]]+/\1\2/g' \ -e 's/(--ns99-relaunch=|ns99\.launcher\.relaunch=)[^[:space:]]*/\1/g' \ > "$dst" fi } listing_file="$tmp_dir/listing.txt" seen_file="$tmp_dir/seen.txt" : > "$listing_file" : > "$seen_file" file_count=0 skipped_hs=0 mac_report_count=0 mac_report_list="$tmp_dir/mac_reports.txt" : > "$mac_report_list" file_mtime_human() { if stat -f "%Sm" -t "%Y-%m-%d %H:%M" "$1" >/dev/null 2>&1; then stat -f "%Sm" -t "%Y-%m-%d %H:%M" "$1" else date -r "$1" "+%Y-%m-%d %H:%M" 2>/dev/null || printf '%s' "unknown" fi } file_mtime_epoch() { if stat -f "%m" "$1" >/dev/null 2>&1; then stat -f "%m" "$1" else stat -c "%Y" "$1" 2>/dev/null || printf '0' fi } add_file() { src="$1" rel="$2" mode="${3:-plain}" [ -f "$src" ] && [ -r "$src" ] || return 0 grep -Fqx "$rel" "$seen_file" 2>/dev/null && return 0 if scrub_file "$src" "$stage/$rel" "$mode"; then printf '%s\n' "$rel" >> "$seen_file" kb=$(( ( $(wc -c < "$src" | tr -d ' ') + 1023 ) / 1024 )) mt=$(file_mtime_human "$src") printf ' %s (%s KB, changed %s)\n' "$rel" "$kb" "$mt" >> "$listing_file" file_count=$((file_count + 1)) fi } # Lists up to N regular files matching pattern in the given directories from the last 30 days, newest first. newest_matches() { limit="$1" pattern="$2" shift 2 list_tmp="$tmp_dir/cand.txt" : > "$list_tmp" for d in "$@"; do [ -d "$d" ] || continue find "$d" -maxdepth 1 -type f -name "$pattern" -mtime "-$days" 2>/dev/null | while IFS= read -r f; do ep=$(file_mtime_epoch "$f") printf '%s\t%s\n' "$ep" "$f" >> "$list_tmp" done done sort -rn -t ' ' -k1,1 "$list_tmp" | awk -F'\t' '!seen[$2]++ { print $2 }' | head -n "$limit" } # 1. Launcher and game logs, crash reports, memory reports and settings. newest_matches 8 "*.log" "$lad/logs" | while IFS= read -r f; do add_file "$f" "launcher-logs/$(basename "$f")" done add_file "$lad/state.json" "launcher-logs/state.json" newest_matches 6 "crash-*.txt" "$ns/logs" "$dk/logs" | while IFS= read -r f; do add_file "$f" "game-crash-reports/$(basename "$f")" done newest_matches 3 "report-*.txt" "$ns/logs" "$dk/logs" | while IFS= read -r f; do add_file "$f" "game-crash-reports/$(basename "$f")" done newest_matches 3 "crashed-run-*.log" "$ns/logs" "$dk/logs" | while IFS= read -r f; do add_file "$f" "game-crash-reports/$(basename "$f")" done newest_matches 1 "crash-history.txt" "$ns/logs" "$dk/logs" | while IFS= read -r f; do add_file "$f" "game-crash-reports/$(basename "$f")" done newest_matches 3 "memory-*.txt" "$ns/logs" "$dk/logs" | while IFS= read -r f; do add_file "$f" "memory-reports/$(basename "$f")" done newest_matches 5 ".running-*" "$ns/logs" "$dk/logs" | while IFS= read -r f; do bn=$(basename "$f") case "$bn" in *.tmp) continue ;; esac add_file "$f" "game-state/${bn#.}.txt" done for cfg_name in crash-recovery.properties graphics-tier.properties frame-rate.properties gpu-switch.properties mouselook.properties oom-restart.properties; do if [ -f "$ns/$cfg_name" ]; then add_file "$ns/$cfg_name" "game-settings/$cfg_name" elif [ -f "$dk/$cfg_name" ]; then add_file "$dk/$cfg_name" "game-settings/$cfg_name" fi done # 2. HotSpot native crash files (only New School 99's, never another Java program's). hs_added=0 hs_cand="$tmp_dir/hs_cand.txt" newest_matches 200 "hs_err_pid*.log" "$lad" "$lad/logs" "$ns" "$ns/logs" "$dk" "${TMPDIR:-/tmp}" "/tmp" > "$hs_cand" while IFS= read -r f; do [ -f "$f" ] || continue if head -c 200000 "$f" 2>/dev/null | grep -Eiq 'New School 99|newschool99|com\.darkan|jagex'; then if [ "$hs_added" -lt 4 ]; then add_file "$f" "java-crash-files/$(basename "$f")" hs hs_added=$((hs_added + 1)) fi else skipped_hs=$((skipped_hs + 1)) fi done < "$hs_cand" # 3. macOS DiagnosticReports for New School 99 (the app by name, or java reports that name the game). if [ -d "$diag_dir" ]; then mac_cand="$tmp_dir/mac_cand.txt" : > "$mac_cand" find "$diag_dir" -maxdepth 1 -type f \( -name "New School 99*.ips" -o -name "New School 99*.crash" -o -name "java*.ips" -o -name "java*.crash" \) -mtime "-$days" 2>/dev/null | while IFS= read -r f; do ep=$(file_mtime_epoch "$f") printf '%s\t%s\n' "$ep" "$f" >> "$mac_cand" done sort -rn -t ' ' -k1,1 "$mac_cand" | awk -F'\t' '{ print $2 }' | head -n 60 > "$tmp_dir/mac_sorted.txt" while IFS= read -r f; do [ -f "$f" ] || continue bn=$(basename "$f") is_ours=0 case "$bn" in "New School 99"*) is_ours=1 ;; java*|Java*) if head -c 200000 "$f" 2>/dev/null | grep -Eiq 'New School 99|newschool99|com\.darkan'; then is_ours=1 fi ;; esac if [ "$is_ours" -eq 1 ] && [ "$mac_report_count" -lt 5 ]; then add_file "$f" "mac-crash-reports/${bn}.txt" macreport mt=$(file_mtime_human "$f") printf '%s %s\n' "$mt" "$bn" >> "$mac_report_list" mac_report_count=$((mac_report_count + 1)) fi done < "$tmp_dir/mac_sorted.txt" fi # 4. system.txt: macOS version, chip, memory, allow-listed graphics/display info, free disk space (never serial/UUID). sys_raw="$tmp_dir/system_raw.txt" os_line="macOS" if command -v sw_vers >/dev/null 2>&1; then os_prod=$(sw_vers -productName 2>/dev/null || echo "macOS") os_ver=$(sw_vers -productVersion 2>/dev/null || true) os_bld=$(sw_vers -buildVersion 2>/dev/null || true) os_line="${os_prod}${os_ver:+ $os_ver}${os_bld:+ (build $os_bld)}" fi arch_name=$(uname -m 2>/dev/null || echo "unknown") mac_model=$(sysctl -n hw.model 2>/dev/null || echo "unknown") mac_chip=$(sysctl -n machdep.cpu.brand_string 2>/dev/null | tr -s ' ' || echo "unknown") mac_cores=$(sysctl -n hw.physicalcpu 2>/dev/null || echo "unknown") mac_rosetta=$(sysctl -n sysctl.proc_translated 2>/dev/null || echo "0") mem_bytes=$(sysctl -n hw.memsize 2>/dev/null || echo "") if [ -n "$mem_bytes" ]; then mem_gb=$(awk -v b="$mem_bytes" 'BEGIN { printf "%.1f GB installed", b / 1073741824.0 }') else mem_gb="unknown" fi disk_line=$(df -h "$home_dir" 2>/dev/null | awk 'NR==2 { print $4 " free of " $2 }' || echo "unknown") lang_val="${LANG:-unknown}" { printf '== macOS\n' printf '%s, %s, language %s, clock UTC%s\n' "$os_line" "$arch_name" "$lang_val" "$now_tz" printf 'Mac: %s\n' "$mac_model" if [ "$mac_rosetta" = "1" ]; then printf 'Chip: %s (%s cores), running under Rosetta\n' "$mac_chip" "$mac_cores" else printf 'Chip: %s (%s cores)\n' "$mac_chip" "$mac_cores" fi printf 'Memory: %s\n' "$mem_gb" printf 'Free space on the home disk: %s\n' "$disk_line" printf '\n== Graphics\n' if command -v system_profiler >/dev/null 2>&1; then gpu_out=$(system_profiler SPDisplaysDataType 2>/dev/null | awk -F': ' ' /^[[:space:]]*(Chipset Model|Total Number of Cores|VRAM \(Total\)|VRAM \(Dynamic, Max\)|Vendor|Metal Support|Metal Family|Automatic Graphics Switching|Display Type|Resolution|UI Looks like): / { gsub(/^[[:space:]]+/, "", $1) print $1 ": " $2 } ' || true) if [ -n "$gpu_out" ]; then printf '%s\n' "$gpu_out" else printf 'unknown\n' fi else printf 'unknown\n' fi printf '\n== New School 99 install\n' if [ -d "/Applications/New School 99.app" ]; then printf 'App: /Applications/New School 99.app\n' else printf 'App: not in /Applications\n' fi if [ -d "$lad/versions" ]; then vers=$(ls -1 "$lad/versions" 2>/dev/null | tr '\n' ',' | sed 's/,$//; s/,/, /g') [ -n "$vers" ] && printf 'Game builds downloaded: %s\n' "$vers" fi printf '\n== macOS crash reports for New School 99 (last %s days, newest first)\n' "$days" if [ "$mac_report_count" -eq 0 ]; then printf 'none\n' else while IFS= read -r rl; do printf -- '--- %s\n' "$rl" done < "$mac_report_list" fi } > "$sys_raw" scrub_file "$sys_raw" "$stage/system.txt" plain # 5. README.txt: what this is, what to do with it, what is inside and what was hidden. readme_raw="$tmp_dir/readme_raw.txt" { printf 'NEW SCHOOL 99 LOGS\n' printf 'Made %s (UTC%s) by the New School 99 Mac log tool, version %s.\n' "$now_human" "$now_tz" "$ver" printf 'Guide: https://newschool99.com/help/logs\n\n' printf 'WHAT TO DO WITH THIS FILE\n' printf '1. Open #bug-reports on the New School 99 Discord (not a member yet? join at https://newschool99.com/discord).\n' printf '2. Click New Post, give it a short title, drag this zip file in and say what you were doing when it went wrong.\n' printf 'We send nothing anywhere. This file stays on your Mac until you post it (a Desktop kept in iCloud Drive keeps a copy in your own iCloud).\n\n' printf 'THE SHORT VERSION\n' printf 'Crash reports macOS kept for the game in the last %s days: %s\n' "$days" "$mac_report_count" printf 'macOS: %s\n' "$os_line" printf 'Mac: %s, %s, %s\n\n' "$mac_model" "$mac_chip" "$mem_gb" printf 'WHAT IS INSIDE\n' printf ' README.txt (this file)\n' printf ' system.txt (macOS version and language, time zone, Mac model, chip, memory, graphics, display, free disk space, and the list of crash reports macOS keeps for New School 99)\n' cat "$listing_file" if [ "$skipped_hs" -gt 0 ]; then printf ' (%s Java crash file(s) from other programs were left out.)\n' "$skipped_hs" fi printf '\nWHAT WAS HIDDEN\n' printf -- '- Your macOS user name and full name are shown as , your Mac name as and your home folder as ~.\n' printf -- '- Your game login name is shown as , but only when the game has remembered it on this Mac. The game never writes your password into these files.\n' printf -- '- Email addresses are shown as , IP addresses as , and passwords, tokens and keys as .\n' printf -- '- Java crash files lose their environment variables and memory dumps. macOS crash reports lose the anonymous report key.\n' printf -- '- Other players named in the game log are shown as where the log line is known. Some may remain.\n\n' printf 'WHAT WAS NOT COLLECTED, AND WHAT WAS\n' printf 'Only New School 99'\''s own folders were read, plus the crash reports macOS keeps for New School 99 and the hardware\n' printf 'summary in system.txt (no serial number, no hardware ID). The crash files do list the file names of other libraries\n' printf 'that were loaded into the game, but nothing else from other programs: no browser data, no documents, pictures or\n' printf 'screenshots, no passwords, no memory dumps. Nothing on your Mac was changed: the only new file is this zip.\n' } > "$readme_raw" scrub_file "$readme_raw" "$stage/README.txt" plain # 6. Write the zip cleanly into the first writable destination (Desktop first). out_dir="" for cand in "$home_dir/Desktop" "$home_dir/Downloads" "$lad" "$ns/logs" "$home_dir"; do if [ -d "$cand" ] && [ -w "$cand" ]; then out_dir="$cand" break fi done if [ -z "$out_dir" ]; then echo "Could not find a writable folder for the zip file. Use the by-hand steps at https://newschool99.com/help/logs#by-hand" >&2 exit 1 fi out_zip="$out_dir/$zip_name" out_partial="${out_zip%.zip}.partial.zip" rm -f "$out_partial" fail_zip() { rm -f "$out_partial" echo "Could not write $out_zip." >&2 exit 1 } if command -v zip >/dev/null 2>&1; then (cd "$stage" && zip -q -r "$out_partial" .) || fail_zip elif command -v ditto >/dev/null 2>&1; then ditto -c -k --sequesterRsrc "$stage" "$out_partial" || fail_zip else echo "No zip tool found on this Mac. Use the by-hand steps at https://newschool99.com/help/logs#by-hand" >&2 exit 1 fi [ -s "$out_partial" ] || fail_zip mv -f "$out_partial" "$out_zip" || fail_zip [ -s "$out_zip" ] || { echo "Could not write $out_zip." >&2; exit 1; } out_partial="" file_count=$(wc -l < "$seen_file" | tr -d ' ') total_files=$((file_count + 2)) printf '\n' if [ "$out_dir" = "$home_dir/Desktop" ]; then printf 'Done! Your New School 99 logs are saved on your Desktop as:\n' else printf 'Done! Your New School 99 logs are saved in %s as:\n' "$out_dir" fi printf ' %s\n' "$zip_name" printf 'It holds %s files, with your private details hidden. We send nothing anywhere.\n' "$total_files" printf 'Next: open #bug-reports on our Discord, click New Post, drag that file in and say what happened.\n' if command -v open >/dev/null 2>&1; then open -R "$out_zip" >/dev/null 2>&1 || true fi )