Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
500 views
in Technique[技术] by (71.8m points)

ruby - Issue installing cocoapods for Flutter on MacOS

Initially, I tried to install Ruby instead of using the on already on MacOS and installed cocoapods using gem install cocoapods however this wouldn't work and was giving the error:

ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

And also tried sudo gem install -n /usr/local/bin cocoapods which gave the error:

Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
    ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf60240306-20262-1w4q438.rb extconf.rb
checking for ffi.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)

For Ruby I am using version: ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19] And when I tried to update the system using sudo gem update --system, it says "Latest version already installed. Done."

Then I downloaded Homebrew and tried to install cocoapods but again I got an error

Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/xcodeproj
Target /usr/local/bin/xcodeproj
already exists. You may want to remove it:
  rm '/usr/local/bin/xcodeproj'

To force the link and overwrite all conflicting files:
  brew link --overwrite cocoapods

To list all files that would be deleted:
  brew link --overwrite --dry-run cocoapods

Possible conflicting files are:
/usr/local/bin/xcodeproj

Then after following advice on another stackoverflow answer, I used brew link --overwrite cocoapods. However, now there is a problem with XCode and the iPhone device simulator won't connect - is showing no device.

I am getting this error during build time:

Showing Recent Messages
/Users/Developer/honours/ios/Flutter/Debug.xcconfig:1: could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig' in search paths

I am not too sure how to fix this and would really appreciate any help!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Solved my issue by using this website, step 4 was incredibly helpful! Then I resolved the issue I had with Xcode not being able to find the xcconfig file by using flutter build ios from this answer. By running flutter build, it told me what the issue was and how I could fix it - I needed to change the default signing identifier.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...