The new MAC system is 11.4, and the installed Xcode version is 13.2.1
after opening a unity project and switching to IOS platform, cocoapods is installed in the background, but an error is reported indicating that the installation fails:
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/ext/ffi_c/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Framewoks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20220311-4106-wxounc.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Framewoks/Ruby.framework/Versions/2.6/usr/lib/ruby/include/ruby.h
You might have to install separate package for the ruby development environment,ruby-dev or ruby-devel for example.
According to the error prompt and query from the network, it should be that a new Ruby Version needs to be installed, and the ruby provided by the system cannot be used
installing Ruby requires RVM, and installing RVM requires homebrew
Install homebrew
Use the command /usr/bin/Ruby - e" $(curl - fssl) is not used here https://raw.githubusercontent.com/Homebrew/install/master/install )"
After installation, execute brew update
update.
Then execute brew -v
to see the installed version
Install RVM
Install RVM curl -L https://get.rvm.io | bash -s stable
reload RVM environment source ~/.rvm/scripts/rvm
View RVM version
RVM -v
Install Ruby
Check the known version of ruby RVM list known
check the installed version of ruby RVM list
Install a ruby version. I chose 2.6.5 RVM install 2.6.5
After installation, check the Ruby Version Ruby -v
. If it is not the version just downloaded, I need to use the command to cut the version
Install cocoapods
After the above installation, execute sudo gem install cocoapods -n/usr/local/bin
to install cocoapods
after the installation, execute pod --version
to view the version of cocoapods
Here, for unit packaging, cocoapods are not completely installed. You need to continue to follow the following steps.
Command + Shift + G, open to the folder
pop-up window, and enter ~/.cocoapods, after opening the cocoapods folder, delete all the contents under it, create a new repos folder, open the command line tool, and execute the following three commands in turn
1) cd ~/.cocoapods/repos
2) git clone --depth 1 https://github.com/CocoaPods/Specs.git master
3) pod repo update
In this way, the Xcode project exported by unity will have Xcworkspace file (in case of problems in cocoapods environment, the exported Xcode project only has .xcodeproj file, and there are many exceptions when using this file for packaging press conference), and then open the file with Xcode for subsequent publishing
Read More:
- Cocoapods Install ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension.
- [Solved] Unity Import Xcode Project Error: iOS framework addition failed due to a CocoaPods installation failure.
- [Solved] Xcode13.1 Upgrade Error: CocoaPods installed but not working Failed to build gem native extension
- How to Solve Cocoapods Installation Failure
- Cocoapods Upgrade Error: ffi * * * * [How to Solve]
- [Solved] Curl: (22) the requested URL returned error: 404 when installing XXX on MAC brew
- Unity Package Webgl Error: Failed running “D:\Program Files\Unity2018.3.0f2\Unity\Editor\Data\PlaybackEngines\Web
- [Solved] cocoapods Error: Runtimeerror – [xcodeproj] unknown object version
- [Solved] Mac Unity Export Android Project Error: Error building Player: Win32Exception
- [Solved] Unity Package Error: Failed running D:\Program Files\Unity2018.4.1\Editor\Data\il2cpp/build/il2cpp.exe
- [Solved] Connection error with cocoapods. Proxy CONNECT aborted
- How to Solve UE Shader develop error
- [Solved] Android Develop Error: xxx does not have a NavController set on xxx
- [Solved] Mac M1 Brew install Error: Command failed with exit 128:git
- [Solved] Unity Error: ‘BuildPipeline‘ does not contain a definition for ‘GetBuildTargetName‘
- MAC: Brew upgrade Error [How to Fix]
- MAC install lightgbm and xgboost Error [How to Solve]
- [Solved] Mac Notebook M1 Chip Install Hashlips library npm error
- [Solved] Mac Install homebrew Error: error: Not a valid ref: refs/remotes/origin/master
- [Solved] Unity Error: Got null handle from IDXGIResource::GetSharedHandle