diff --git a/MCPForUnity/Editor/Constants/EditorPrefKeys.cs b/MCPForUnity/Editor/Constants/EditorPrefKeys.cs index d8aa8e3f5..498034767 100644 --- a/MCPForUnity/Editor/Constants/EditorPrefKeys.cs +++ b/MCPForUnity/Editor/Constants/EditorPrefKeys.cs @@ -71,5 +71,7 @@ internal static class EditorPrefKeys internal const string LogRecordEnabled = "MCPForUnity.LogRecordEnabled"; internal const string ExecuteCodeCompiler = "MCPForUnity.ExecuteCode.Compiler"; + + internal const string MacOSTerminalApp = "MCPForUnity.MacOSTerminalApp"; } } diff --git a/MCPForUnity/Editor/Services/Server/TerminalLauncher.cs b/MCPForUnity/Editor/Services/Server/TerminalLauncher.cs index 49ec84817..7431c9d96 100644 --- a/MCPForUnity/Editor/Services/Server/TerminalLauncher.cs +++ b/MCPForUnity/Editor/Services/Server/TerminalLauncher.cs @@ -1,6 +1,8 @@ using System; using System.IO; +using MCPForUnity.Editor.Constants; using MCPForUnity.Editor.Helpers; +using UnityEditor; using UnityEngine; namespace MCPForUnity.Editor.Services.Server @@ -45,10 +47,12 @@ public System.Diagnostics.ProcessStartInfo CreateTerminalProcessStartInfo(string "clear\n" + $"{command}\n"); ExecPath.TryRun("/bin/chmod", $"+x \"{scriptPath}\"", Application.dataPath, out _, out _, 3000); + string terminalApp = EditorPrefs.GetString(EditorPrefKeys.MacOSTerminalApp, "Terminal"); + if (string.IsNullOrWhiteSpace(terminalApp)) terminalApp = "Terminal"; return new System.Diagnostics.ProcessStartInfo { FileName = "/usr/bin/open", - Arguments = $"-a Terminal \"{scriptPath}\"", + Arguments = $"-a \"{terminalApp}\" \"{scriptPath}\"", UseShellExecute = false, CreateNoWindow = true }; diff --git a/MCPForUnity/Editor/Windows/EditorPrefs/EditorPrefsWindow.cs b/MCPForUnity/Editor/Windows/EditorPrefs/EditorPrefsWindow.cs index b683a21a5..f11d80409 100644 --- a/MCPForUnity/Editor/Windows/EditorPrefs/EditorPrefsWindow.cs +++ b/MCPForUnity/Editor/Windows/EditorPrefs/EditorPrefsWindow.cs @@ -77,6 +77,7 @@ public class EditorPrefsWindow : EditorWindow { EditorPrefKeys.LastLocalHttpServerPidArgsHash, EditorPrefType.String }, { EditorPrefKeys.LastLocalHttpServerPidFilePath, EditorPrefType.String }, { EditorPrefKeys.LastLocalHttpServerInstanceToken, EditorPrefType.String }, + { EditorPrefKeys.MacOSTerminalApp, EditorPrefType.String }, }; // Templates