From 698b14789cb0777961fe5f1d4363387f9f185b1b Mon Sep 17 00:00:00 2001 From: Dmitry Minkovsky Date: Wed, 20 Jul 2022 07:06:18 -0700 Subject: [PATCH] Use readlink instead of realpath in packager.sh (#34145) Summary: `realpath` is not available on macOS 12.2 and 12.4. Because of this, the following error is shown when launching an RN app with XCode (which calls `packager.sh` via `launchPackage.command`): Screen Shot 2022-07-06 at 1 26 08 PM I am running Bash 5 but realpath is also not available with zsh. This issue was introduced in https://github.com/facebook/react-native/commit/bb8ddd6c1247fde230a60c662a318422df52516e#diff-6ca7c99209bdf630550bb9e2946ce8611948c5a23b32ffb25028792ef5d48b8d, which interestingly did not change `launchPackage.command`. There's a recent comment on that commit that confirms this issue: https://github.com/facebook/react-native/commit/bb8ddd6c1247fde230a60c662a318422df52516e#commitcomment-77818917 ## Changelog [iOS] [Fixed] - Use readlink instead of realpath in packager.sh Pull Request resolved: https://github.com/facebook/react-native/pull/34145 Reviewed By: cipolleschi Differential Revision: D37669417 Pulled By: cortinico fbshipit-source-id: bcc4cb6e886df059e6598ee811226e3cd1a6ae14 --- scripts/packager.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/packager.sh b/scripts/packager.sh index b9f90160f1..acb1581257 100755 --- a/scripts/packager.sh +++ b/scripts/packager.sh @@ -5,7 +5,7 @@ # LICENSE file in the root directory of this source tree. # scripts directory -THIS_DIR=$(cd -P "$(dirname "$(realpath "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) +THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) REACT_NATIVE_ROOT="$THIS_DIR/.." # Application root directory - General use case: react-native is a dependency PROJECT_ROOT="$THIS_DIR/../../.."