Consider add a command line option to set ghostty as macOS default terminal app #8111
Replies: 5 comments 2 replies
-
|
This is more useful than simply associate file type with the default opening app, since it is a simpler operation and will work for Finder's Open in Terminal right click menu. |
Beta Was this translation helpful? Give feedback.
-
|
note you shouldnt link or show iterm2 source code its GPLv2 which is not a compatible license with MIT. its probably fine in this case since its very small but it is a warning, to be safe you should just say these functions can do it without pasting the source from iterm |
Beta Was this translation helpful? Give feedback.
-
|
Just a thought, but maybe this could work in a cross-platform manner as it's also not very straightforward to set the default terminal on certain Linux desktop environments. Need to do more research before I can say that for certain though |
Beta Was this translation helpful? Give feedback.
-
|
Actually, On the Linux side it's slightly more Cursed. There is no agreed-upon standard for specifying which terminal to use when running terminal-based apps (completely unsurprising for Linux all things considered), and people are trying to write specifications and standards but it seems like we still have a long way to go. Fortunately though, I discovered that GIO (which powers all GTK apps like Firefox) uses xdg-terminal-exec if it's found, which is customizable enough with a simple text configuration file. GNOME apps like Nautilus also work, which is enough of a success in my book. In theory all we have to do is to edit xdg-terminal-exec's config file, and instruct people to install it (or its many reimplementations) for things to work. Not all apps would work just yet, but it's something at the very least. |
Beta Was this translation helpful? Give feedback.
-
|
Is there currently any way to set Ghostty as default on Mac? |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In macOS, there is a hidden default terminal app option that was accessible in earlier versions but has been somewhat restricted since macOS Ventura, primarily due to the new System Settings UI. While the graphical interface no longer allows for direct modification of this setting, it is still possible to interact with macOS APIs to achieve this functionality.
iTerm2, for instance, leverages macOS APIs to set itself as the default terminal by using makeITermDefaultTerminal function in iTermLaunchServices.m. And the method setDefaultTerminal performs the actual change.
The idea is that we can use a approach to set ghostty as the default terminal via a command-line option. For example, implementing a command like:
This command could trigger the necessary interaction with the macOS APIs, changing the default terminal to ghostty. The backend would interface with the
LSSetDefaultRoleHandlerForContentTypefunction, pointing to ghostty's bundle ID and setting it as the default handler for UNIX executable files (i.e., terminal-related content).This approach ensures that ghostty can be easily set as the default terminal.
Beta Was this translation helpful? Give feedback.
All reactions