From 292ed40bfaf213763f100f90ccb1e255c4c51250 Mon Sep 17 00:00:00 2001 From: CLRT19 Date: Fri, 23 Jan 2026 14:11:13 -0500 Subject: [PATCH] Fix automatic activation on macOS 15 (Sequoia) and later macOS 15 (Sequoia) and macOS 26 (Tahoe) introduced security restrictions that prevent third-party input methods from being enabled programmatically using TISEnableInputSource(). This commit addresses the issue by: 1. Detecting when automatic activation fails on macOS 15+ 2. Showing a user-friendly dialog with step-by-step instructions 3. Offering to open System Settings directly to the Input Sources page 4. Updating README with installation instructions for macOS 15+ 5. Adding FAQ entry explaining the manual activation requirement The activate script now checks if the input method was successfully enabled after calling TISEnableInputSource(). If it fails on macOS 15 or later, it displays a dialog guiding users to manually enable the input method through System Settings. Fixes automatic activation issue on macOS Sequoia and Tahoe. Co-Authored-By: Claude Sonnet 4.5 --- README.md | 22 +++++++++++++++++++--- activate/main.m | 44 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 61 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1f7b04a..8caa74b 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,14 @@ The latest version is Version 1.3. To install or update Math Symbols Input: 1. Download the [installer for the latest version](https://github.com/knrafto/MathSymbolsInput/releases/latest/download/MathSymbolsInput.pkg). 2. Open the installer and continue through the installation steps. -3. Log out and log back in (or reboot). - -The installer can enable the input method automatically. If you want to configure input sources, see the [macOS help page on input sources]( +3. **macOS 15 (Sequoia) and later**: Due to security restrictions, you will need to manually enable the input method after installation: + - Go to **System Settings → Keyboard → Input Sources** + - Click the **+** button + - Find **Math Symbols Input** under English + - Add it to your input sources +4. Log out and log back in (or reboot). + +On macOS 14 (Sonoma) and earlier, the installer can enable the input method automatically. For more information about configuring input sources, see the [macOS help page on input sources]( https://support.apple.com/guide/mac-help/type-language-mac-input-sources-mchlp1406/mac). # Usage @@ -38,6 +43,17 @@ New commands will take effect immediately. # FAQ +## The input method isn't working after installation on macOS 15 or later + +Starting with macOS 15 (Sequoia), Apple introduced security restrictions that prevent third-party input methods from being enabled automatically during installation. You need to manually enable Math Symbols Input: + +1. Go to **System Settings → Keyboard → Input Sources** +2. Click the **+** button +3. Find **Math Symbols Input** under English +4. Add it to your input sources + +After adding the input method, you can switch to it using the input source menu in the menu bar or with the keyboard shortcut (typically Control+Space or Control+Option+Space). + ## Are there Windows or Linux versions? Not yet, but hopefully soon. diff --git a/activate/main.m b/activate/main.m index 6fa84f5..08e000c 100644 --- a/activate/main.m +++ b/activate/main.m @@ -1,13 +1,36 @@ #import +#import static const char *kInstallLocation = "/Library/Input Methods/Math Symbols Input.app"; static NSString *kProcessName = @"Math Symbols Input"; static NSString *kSourceID = @"com.mathsymbolsinput.inputmethod.MathSymbolsInput"; -static void logIfError(OSStatus status, NSString *message) { +static BOOL logIfError(OSStatus status, NSString *message) { if (status != noErr) { NSError *error = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil]; NSLog(@"%@: %@", message, [error localizedDescription]); + return YES; + } + return NO; +} + +static BOOL isMacOS15OrLater(void) { + NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion]; + return version.majorVersion >= 15; +} + +static void showManualActivationDialog(void) { + NSAlert *alert = [[NSAlert alloc] init]; + [alert setMessageText:@"Math Symbols Input Installation Complete"]; + [alert setInformativeText:@"Due to macOS security restrictions, you need to manually enable the input method:\n\n1. Go to System Settings → Keyboard → Input Sources\n2. Click the + button\n3. Find \"Math Symbols Input\" under English\n4. Add it to your input sources\n\nWould you like to open System Settings now?"]; + [alert setAlertStyle:NSAlertStyleInformational]; + [alert addButtonWithTitle:@"Open System Settings"]; + [alert addButtonWithTitle:@"Later"]; + + NSModalResponse response = [alert runModal]; + + if (response == NSAlertFirstButtonReturn) { + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"x-apple.systempreferences:com.apple.Keyboard-Settings.extension"]]; } } @@ -63,9 +86,26 @@ int main(int argc, const char *argv[]) { [NSThread sleepForTimeInterval:1.0]; NSLog(@"Enabling input source %@", kSourceID); - logIfError(TISEnableInputSource(inputMethod), @"Could not enable input source"); + OSStatus enableStatus = TISEnableInputSource(inputMethod); + BOOL enableFailed = logIfError(enableStatus, @"Could not enable input source"); [NSThread sleepForTimeInterval:1.0]; + // Check if the input method is actually enabled after attempting to enable it + BOOL isEnabled = CFBooleanGetValue(TISGetInputSourceProperty(inputMethod, kTISPropertyInputSourceIsEnabled)); + + if (!isEnabled || enableFailed) { + NSLog(@"Input source could not be automatically enabled. Manual activation required."); + + // On macOS 15 (Sequoia) and later, automatic activation is blocked by security restrictions + if (isMacOS15OrLater()) { + NSLog(@"Detected macOS 15 or later. Showing manual activation instructions."); + showManualActivationDialog(); + } + + CFRelease(inputSources); + return 0; + } + NSLog(@"Selecting input source %@", kSourceID); logIfError(TISSelectInputSource(inputMethod), @"Could not select input source");