I just started learning how to write my own Cocoapod yesterday. There’s a great tutorial to get you started. However, I ran into an issue when trying to lint my new spec. It looked like this:
$ pod spec lint MyAwesomeLibrary.podspec -> MyAwesomeLibrary (0.0.1) - ERROR | [iOS] [xcodebuild] 2013-05-29 23:03:08.370 xcodebuild[91499:3f03] error: Error Domain=NSPOSIXErrorDomain Code=2 "Non-zero exit code 255 returned from shell command: /usr/bin/gcc-4.2 -v -E -dM -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -x objective-c -c /dev/null 2>&1" UserInfo=0x4001c4e60 {NSLocalizedDescription=Non-zero exit code 255 returned from shell command: /usr/bin/gcc-4.2 -v -E -dM -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -x objective-c -c /dev/null 2>&1, NSLocalizedFailureReason=No such file or directory} - ERROR | [iOS] [xcodebuild] 2013-05-29 23:03:08.457 xcodebuild[91499:3f03] error: Error Domain=NSPOSIXErrorDomain Code=2 "Non-zero exit code 1 returned from shell command: /usr/bin/gcc-4.2 -v -E -dM -arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -x objective-c -c /dev/null 2>&1" UserInfo=0x4018946a0 {NSLocalizedDescription=Non-zero exit code 1 returned from shell command: /usr/bin/gcc-4.2 -v -E -dM -arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -x objective-c -c /dev/null 2>&1, NSLocalizedFailureReason=No such file or directory} Analyzed 1 podspec. [!] The spec did not pass validation. |
When I manually ran the command in the above error message, I saw this error:
$ /usr/bin/gcc-4.2 -v -E -dM -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -x objective-c -c /dev/null 2>&1 gcc-4.2: error trying to exec '/usr/bin/arm-apple-darwin11-gcc-4.2.1': execvp: No such file or directory |
I don’t have the file “/usr/bin/arm-apple-darwin11-gcc-4.2.1″. If you see this too, you should check whether you have a preferred C Compiler. This is configured via the CC
environment variable. Mine was set to gcc-4.2
.
$ echo $CC gcc-4.2 |
To let cocoapods use the default compiler instead, just run the linter as
$ CC= pod spec lint MyAwesomeLibrary.podspec -> MyAwesomeLibrary (0.0.1) Analyzed 1 podspec. MyAwesomeLibrary.podspec passed validation. |
Woohoo! It passed!
Thank You!!