File tree Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -61,10 +61,27 @@ export class CocoaPodsService implements ICocoaPodsService {
6161 const args = [ "install" ] ;
6262
6363 if ( process . platform === "darwin" && process . arch === "arm64" ) {
64- this . $logger . trace ( "Running on arm64 - running pod through rosetta2." ) ;
65- args . unshift ( podTool ) ;
66- args . unshift ( "-x86_64" ) ;
67- podTool = "arch" ;
64+ // check if pod is installed as an x86_64 binary or a native arm64 one
65+ // we run the following:
66+ // arch -x86_64 pod --version
67+ // if it's an arm64 binary, we'll get something like this as a result:
68+ // arch: posix_spawnp: pod: Bad CPU type in executable
69+ // in which case, we should run it natively.
70+ const res : string = await this . $childProcess
71+ . exec ( "arch -x86_64 pod --version" , null , {
72+ showStderr : true ,
73+ } )
74+ . then ( ( res ) => res . stdout + " " + res . stderr )
75+ . catch ( ( err ) => err . message ) ;
76+
77+ if ( ! res . includes ( "Bad CPU type in executable" ) ) {
78+ this . $logger . trace (
79+ "Running on arm64 but pod is installed under rosetta2 - running pod through rosetta2"
80+ ) ;
81+ args . unshift ( podTool ) ;
82+ args . unshift ( "-x86_64" ) ;
83+ podTool = "arch" ;
84+ }
6885 }
6986 // cocoapods print a lot of non-error information on stderr. Pipe the `stderr` to `stdout`, so we won't polute CLI's stderr output.
7087 const podInstallResult = await this . $childProcess . spawnFromEvent (
You can’t perform that action at this time.
0 commit comments