40

Error: System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory

in mac os catalina

Jonas
  • 121,568
  • 97
  • 310
  • 388
Sagar Kachhadiya
  • 1,025
  • 2
  • 9
  • 24

7 Answers7

122

You can fix it by running

sudo gem install -n /usr/local/bin cocoapods 
Zeeshan Ansari
  • 9,657
  • 3
  • 26
  • 27
21

I face the same problem on Catalina and tried these 2 steps hopefully it will work

brew install cocoapods --build-from-source

brew link --overwrite cocoapods
Dharmbir Singh
  • 17,485
  • 5
  • 50
  • 66
8

Run the following command in terminal

sudo gem install cocoapods

For more details follow this link.

https://github.com/CocoaPods

Imran
  • 3,045
  • 2
  • 22
  • 33
8

This solution worked for me.

1) Go to Xcode preferences -> Locations 'tab'. See image for Locations 'tab'.

2) Check the Command Line Tools section. If it's blank, make sure your current command line tools is selected. See image for Command Line Tools Section.

3) Run sudo gem install -n /usr/local/bin cocoapods

It worked like a charm for me. Hope it does for someone else too. Happy coding!

Dave
  • 81
  • 1
  • 2
1

None of the suggestions worked for me. The issue could only be resolved by adding the correct Ruby path in the profile such as:

export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.6.0/bin/:$PATH"
Yoku
  • 307
  • 5
  • 16
0

I solved it like this

1) cd ~/.cocoapods

2) rm -r repos

3) sudo gem install cocoapods

4) pod install

Mujahed Ansari
  • 419
  • 4
  • 13
0

Maybe try using the cocoapods installed through homebrew. It works for me. – Snowfish

This comment by Snowfish on the question helped me using cocoapods.