Objective Sharpie执行pod list失败求助,附相关环境信息
I've run into this exact issue before, and since your native iOS projects work fine with CocoaPods, the problem is almost certainly related to how Objective Sharpie interacts with your Pod environment rather than CocoaPods itself. Here are the most reliable fixes I've found:
1. Ensure Objective Sharpie can locate the pod executable
Sometimes Sharpie doesn't pick up the correct path to your pod command, especially if you installed CocoaPods via Homebrew or a custom location.
- First, run
which podin Terminal to get the full path (e.g.,/usr/local/bin/pod) - Try running Sharpie with the full pod path explicitly:
sharpie pod init --pod-path /usr/local/bin/pod(replace with your actual path) - If this works, it's an environment variable issue. You can either add the pod path to Sharpie's environment or keep using the full path for future commands.
2. Update Objective Sharpie to a compatible version
Your Sharpie 3.4.0 is pretty outdated, and there are known compatibility gaps with CocoaPods 1.4.0.
- Uninstall the old version first:
sharpie uninstall - Install the latest stable version via Homebrew:
brew install objective-sharpie, or grab the latest package from official release channels - Verify the update with
sharpie version, then retry your pod binding command
3. Clear CocoaPods and Sharpie cache files
Cache corruption is a common culprit here:
- Clear all CocoaPods caches:
pod cache clean --all - Delete Sharpie's temporary cache directory:
rm -rf ~/Library/Caches/com.xamarin.ObjectiveSharpie - Restart your terminal and try the Sharpie command again
4. Check for permission issues
Sharpie might not have sufficient access to read/write Pod-related files:
- Try running the Sharpie command with sudo:
sudo sharpie pod init [YourPodName] - Note: Files created with sudo will be owned by root, so after running, reset permissions with
sudo chown -R $USER:$USER [YourProjectDirectory]to avoid future access problems
5. Manually set up the Pod project first, then use Sharpie
Since your native Pod workflow works, bypass Sharpie's initial pod setup:
- Create an empty folder, run
pod initinside it, then edit the Podfile to include your target pod - Run
pod installto pull down the dependencies - Point Sharpie to this pre-configured project:
sharpie pod bind --output=./output ./Podfile
These steps should resolve the "Failed to run pod list" error. For me, updating Sharpie and clearing caches was the quick fix in a similar environment setup.
内容的提问来源于stack exchange,提问作者dvilla

