Search code examples
react-nativemacosmetro-bundlermacos-ventura

“launchPackager.command” can’t be opened


Just updated my Mac to the official release of Ventura, and I cannot launch my application via react-native run-ios.

Expected behavior:

running react-native run-ios will launch an Xcode simulator and a terminal window with Metro running.

Current behavior:

Xcode simulator opens, main terminal says app was built successfully, but an error is thrown instead of the metro terminal opening:

“launchPackager.command” can’t be opened because (null) is not allowed to open documents in Terminal.

The simulator just shows a white screen and can't be interacted with.

What I've tried:

  • manually opening node_modules/react-native/scripts/launchPackager.command
    • opens Metro terminal but is not connected to the app

warn No apps connected. Sending "reload" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB. info Reloading app...

  • giving Terminal full disk access (no change)

Solution

  • This happened to me after upgrading to macOS Ventura. I happen to use iTerm as my main terminal, not the built-in Terminal.app so the following fix only applies to that scenario:

    Set iTerm as the Default Handler for *.command Files

    1. Open node_modules/react-native/scripts/ in Finder (open node_modules/react-native/scripts/)
    2. Right-Click on launchPackager.command and click Open With then choose Other...
    3. In your Applications directory, select iTerm and click Always Open With

    After this, you might need to run npm run ios again from this terminal window. However, from now on, Metro will open in a new iTerm tab instead of trying to open the command in a new Terminal window.

    For me, this was the desired behaviour and it removed this warning.

    Note In future, any *.command files will now open with iTerm instead of Terminal.