Cli: Open Metro in iTerm on macOS

Created on 9 Apr 2019  路  6Comments  路  Source: react-native-community/cli

Describe the Feature

A lot of people use iTerm 2 on macOS. When using run-android or run-ios, Metro is started in Terminal.app even when launched from iterm. Ideally we'd create a new tab or window in iTerm.

Possible Implementations

  • If there is a way to detect whether run-android/ios was invoked from within iTerm, use iTerm.
  • Otherwise, provide a way to set this as a configuration (per project, per computer) once and reuse the setting

Related Issues

Note that run-android already has an option to chose the terminal via an environment variable. It looks like it should work but it didn't when I just tested it.

feature request

Most helpful comment

You can always open Finder and find the launchPackager.command file under node_modules/react-native/scripts/. Right click the file, choose get info, then change the "Open with:" section to iTerm, and click on Change All.

All 6 comments

Current terminal is available behind TERM_PROGRAM (at least on macOS), so we should likely try that before the REACT_TERMINAL and a default one.

You can always open Finder and find the launchPackager.command file under node_modules/react-native/scripts/. Right click the file, choose get info, then change the "Open with:" section to iTerm, and click on Change All.

npx react-native run-ios also open Terminal.app

anyone ... maybe @lucasbento ... clear on why both of these still open Terminal.app, not iTerm?

$ yarn react-native run-ios --terminal iTerm

$ REACT_TERMINAL=iTerm yarn react-native run-ios

I've also tried iTerm.app instead of iTerm and the behavior is the same

macOS 10.17.7
react-native-community/cli: 4.13.1
react-native: 0.63.4

@swrobel I think the --terminal attribute only applies to the build of the project. Metro always loads in teminal.app for me, no matter what you try changing this to. I resolved this with the handy hint from @TheTalonHughes above.

Thanks @mattwoberts but the examples provided in https://github.com/react-native-community/cli/pull/310 indicate that it should work with run-ios...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mauricioscotton picture mauricioscotton  路  3Comments

jchook picture jchook  路  4Comments

patrickkempff picture patrickkempff  路  4Comments

owinter86 picture owinter86  路  3Comments

jacargentina picture jacargentina  路  4Comments