43

I have got a new MacBook, and are trying to install some pods. I first did sudo gem install cocoapods on root, then did pod install in the directory I need the pods. Got this error, and have no clue what went wrong.

From Crash Report:
Process: ruby [5444] Path: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby Identifier: ruby Version: 145.100.1 Code Type: ARM-64 (Native) Parent Process: zsh [5282] Responsible: Terminal [5005] User ID: 501

Date/Time: 2021-09-27 21:24:20.779 +0200 OS Version: macOS 11.6 (20G165) Report Version: 12 Anonymous UUID: --D950-78ED-2DF378C6BA5B

Sleep/Wake UUID: -FE18-47F9-9A4EF2935C96

Time Awake Since Boot: 29000 seconds Time Since Wake: 1900 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_INSTRUCTION (SIGABRT) Exception Codes: 0x0000000000000001, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY

Application Specific Information: dyld3 mode abort() called.
x
x
x
x
External Modification Summary: Calls made by other processes targeting this process: task_for_pid: 0 thread_create: 0 thread_set_state: 0 Calls made by this process: task_for_pid: 0 thread_create: 0 thread_set_state: 0 Calls made by all processes on this machine: task_for_pid: 0 thread_create: 0 thread_set_state: 0

VM Region Summary: ReadOnly portion of Libraries: Total=574.8M resident=0K(0%) swapped_out_or_unallocated=574.8M(100%) Writable regions: Total=356.4M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=356.4M(100%)

                            VIRTUAL   REGION 

REGION TYPE SIZE COUNT (non-coalesced) =========== ======= ======= Activity Tracing 256K 1 Kernel Alloc Once 32K 1 MALLOC 105.2M 32 MALLOC guard page 96K 5 MALLOC_MEDIUM (reserved) 240.0M 2 reserved VM address space (unallocated) STACK GUARD 56.1M 4 Stack 10.6M 4 VM_ALLOCATE 1.0G 4 VM_ALLOCATE (reserved) 12K 1 reserved VM address space (unallocated) __AUTH 273K 64 __AUTH_CONST 3528K 153 __DATA 1616K 162 __DATA_CONST 4536K 173 __DATA_DIRTY 313K 63 __LINKEDIT 490.7M 27 __OBJC_CONST 437K 41 __OBJC_RO 75.1M 1 __OBJC_RW 2576K 1 __TEXT 84.2M 185 __UNICODE 588K 1 shared memory 32K 2 =========== ======= ======= TOTAL 2.1G 927 TOTAL, minus reserved VM space 1.8G 927

Anvil
  • 1,745
  • 1
  • 11
  • 16

7 Answers7

97

Solved by using homebrew
brew install cocoapods

Anvil
  • 1,745
  • 1
  • 11
  • 16
  • 4
    Make sure you don't have previously installed cocoapods with gem. If so - uninstall it first by typing sudo gem uninstall cocoapods. – user-123 Dec 26 '21 at 21:42
  • It did the trick for me, but only after removing cocoapods as a gem (?) https://superuser.com/questions/686317/how-to-fully-uninstall-the-cocoapods-from-the-mac-machine – iuliu.net Jan 27 '22 at 21:10
  • 1
    For M1 Chip follow below URLs https://stackoverflow.com/questions/64963370/error-cannot-install-in-homebrew-on-arm-processor-in-intel-default-prefix-usr https://developer.apple.com/forums/thread/652822 – Nisarg Thakkar Apr 22 '22 at 07:12
  • M2 Chip macbook here. Works! Glad I came across this post. Google should have specifically indicated what command to run if Apple chip or not – chitgoks Oct 04 '22 at 06:45
39

For those running on Apple Silicon, this has worked for me:

Uninstall with Ruby: sudo gem uninstall cocoapods

Then, install again with brew: brew install cocoapods

Junior
  • 531
  • 4
  • 6
18

Try using Rosetta terminal

Locate Terminal.app in Finder. (Applications->Terminal.app)
Right-click and choose Get Info
Check the “Open using Rosetta”
Quit all instances of Terminal app and run it again
Run sudo gem install ffi
Run pod install

https://armen-mkrtchian.medium.com/run-cocoapods-on-apple-silicon-and-macos-big-sur-developer-transition-kit-b62acffc1387

Prakash S
  • 632
  • 6
  • 12
17

I had the same issue, but just had to close all instances of my terminal windows after installing cocoapods.

Evan
  • 181
  • 1
  • 2
  • 4
    After few tens of installing with gem, and/or brew, and trying many many things. Just restart terms has worked like it was magic. incomprehensible THANK YOU – Romain TAILLANDIER Feb 14 '22 at 15:50
5

if you use silicon M1 processor Macbook, you can use below command

sudo arch -x86_64 gem install ffi

Then

arch -x86_64 pod install
Emre Gürses
  • 1,992
  • 1
  • 23
  • 28
  • it did resolve my issue what is ffi – Khurram Iqbal Jan 27 '23 at 13:07
  • Ruby-FFI is a gem for programmatically loading dynamically-linked native libraries, binding functions within them, and calling those functions from Ruby code. Moreover, a Ruby-FFI extension works without changes on CRuby (MRI), JRuby, Rubinius and TruffleRuby. @KhurramIqbal – Emre Gürses Jan 27 '23 at 13:46
4

Closing all instances of Terminal, then re-opening terminal and running pod install in the relevant directory did the job for me :)

jawkhan
  • 57
  • 3
0

Open Terminal.app in Finder. (show in finder) Right-click and choose Get Info Check the “Open using Rosetta” Quit all instances of Terminal app and run it again type "sudo gem install ffi" and run on terminal type "sudo pod install" and run on terminal