fix: force server to always start in a new window on macOS #2628
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes an issue on macOS where the server wasn't reliably being launched in a new terminal window. The solution involves using the
-na
flag combination with theopen
command instead of just-a
, which ensures that a new instance of the terminal application is always created.As per the man entry for
open
:The issue was identified in a Ghostty discussion which pointed out that some terminals work around the fact that
open -a
does not inherit the current environment it's being run in by explicitly injecting the environment variables, the standard and reliable way to ensure a new window is created and the environment variables are correctly set is to use the-n
flag explicitly with the macOSopen
command.This change ensures consistent behavior across all terminal emulators on macOS.
Test Plan
I've verified this change by:
To test this yourself:
npx react-native start
Checklist
react-native
checkout (instructions).