I can not do a "pod install" in CocoaPods - xcode

I can not do a "pod install" in any project.
But the thing is that before it could.
What has changed from before to now?
Basically I have installed the new Xcode 10.1 and the new Mojave operating system.
Before I could do all the pod functions and not now. The error that I get is the following:
The Podfile is the following:
EDIT:
If I write:
xcode-select -p
If I write:
xcode-select -s /Applications/Xcode.app/Contents/Developer
Any idea what it can be? Nor did I just see what the error is. Do you see it? I have tried different solutions than those proposed but they do not work ... It's stressful !!

Execute this command in Terminal and try again:
xcode-select -s /Applications/Xcode.app/Contents/Developer
And be sure to update your Cocoapods spec repository by running pod repo update before pod install
Description:
The error is because the wrong path was set as the Xcode Command Line Tools. this can lead to many problems such as git error, C compiler error etc.
Always be sure your Xcode Command Line Tools path has been set to embedded Command Line Tools in Xcode app.

Related

React-Native Error + Bug in Ruby Interpreter: Failed to install CocoaPods dependencies for iOS project, which is required by this template

I am very new to Apple and app programming so please forgive me if I am not asking my questions in the perfect "format" that you might be expecting...
I bought my MacBook Air running on M1 chip just few days ago and would like to program with Xcode and React Native. As I do the common command "npx react-native init AwesomeProject" I got into the error which I saw quite some other people also run into:
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
I tried all of the suggestions available on other posts (assuming I am understanding the remedies correctly and making the changes accordingly) but none seem to work for me.
I tried also the default suggested solution which is:
Please try again manually: "cd ./AwesomeProject/ios && pod install".
And I seem to get something different from others, which is:
Analyzing dependencies Fetching podspec for DoubleConversion from
../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec
Fetching podspec for RCT-Folly from
../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec
Fetching podspec for glog from
../node_modules/react-native/third-party-podspecs/glog.podspec
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.1/lib/ffi/library.rb:275: [BUG]
Bus Error at 0x0000000102a08000 ruby 2.6.3p62 (2019-04-16 revision
67580) [universal.arm64e-darwin20]
and then
You may have encountered a bug in the Ruby interpreter or extension
libraries.
Is it something to do with my Ruby interpreter? If yes, what are the commands I could use to solve the issue???
https://github.com/CocoaPods/CocoaPods/issues/10349#issuecomment-849468291
brew install cocoapods
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install
In my case, need to restart my terminal before execute pod install. Monterey + M1.
The top answer doesn't work for me on my MBP M1 so I fixed the issue this way :
Make sure you have opened project.xcworkspace and not the project.xcodeproj
Open the workspace file with xcode with clicking on it then go to File -> Workspace Settings ... -> Build System -> Legacy Build System
Select the project file then the Target then go to Build Settings Tab and Search Paths
Double click on Library Search Paths Debug and move the $(inherited) to the bottom of the list
Do the same for the Release .
Then Build Again and you're good to go .
If you still get any errors run these commands in the ios folder of the react native project and do the above steps again and it will build successfully.
rm -rf ~/Library/Developer/Xcode/DerivedData/
pod deintegrate
pod install
If you are facing this issue in Mac Big Sur, reinstalling CommandLineTools can fix this issue.
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

`xcodebuild` not working from terminal

After I used migration assistant to migrate data from my old mac to a new one I can no longer use Xcode command line tools. Whenever I run any xcodebuild command in terminal (even xcodebuild with no parameters) I get the following error:
dyld: Library not loaded: #rpath/DVTFoundation.framework/Versions/A/DVTFoundation
Referenced from: /usr/bin/xcodebuild
Reason: image not found
Abort trap: 6
When I run which xcodebuild I get /usr/bin/xcodebuild.
When I run xcode-select -p I get /Applications/Xcode.app/Contents/Developer.
Strangely, if I go to /Applications/Xcode.app/Contents/Developer/usr/bin and call ./xcodebuild I do not get the error above.
Here is what I tried:
Installing command line tools using xcode-select --install.
Uninstalling command line tools located in /Library/Developer/CommandLineTools/.
Performing sudo xcode-select --switch /Library/Developer/CommandLineTools/.
Performing sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/.
None of these resolves my problem.
I am running Xcode 9.4.1 and macOS High Sierra 10.13.5.
UPDATE 1
I tried following this guide to uninstall Xcode and all command line build tools completely. The strange thing is, once I followed all the steps, running xcodebuild command produced the same result as before. And xcodebuild was still located in /usr/bin.
UPDATE 2
If I install command line tools using xcode-select --install and go to /Library/Developer/CommandLineTools/usr/bin running xcodebuild from that location does produce the same error. So, running xcodebuild which comes pre-installed with Xcode produces no error, but the one from the command line tools does produce the error. It is puzzling and also suggests that when I try to remove all command line tools, the ones left in my /usr/bin are the ones which do not come with Xcode.
I tried deleting them, but I am unsuccessful even with the sudo command.
UPDATE 3
I've found a workaround. To ensure that xcodebuild command uses the tool located in /Applications/Xcode.app/Contents/Developer/usr/bin rather than the one located in /usr/bin, I added the following line to my .bash_profile:
export PATH="/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH"
This approach works, but my question remains. I do not understand why I had this problem in the first place. I have double checked - my PATH does not contain /Applications/Xcode.app/Contents/Developer/usr/bin on my old Mac and everything works just fine there.
Looks like for some reason, xcodebuild located in /usr/bin got corrupted and couldn't get updated in any way.

xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist

I'm having xcode issues when I try to use brew and git:
xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist, use xcode-select --switch path/to/Xcode.app to specify the Xcode that you wish to use for command line developer tools (or see man xcode-select)
I can type xcode-select and it shows that the command exists. When I type xcode-select -p it shows:
/Applications/Xcode.app/Contents/Developer
but when I do which xcode-select, it gives me:
/usr/bin/xcode-select
I've tried to use the command switch and install again via Apple Developer site but none of these options have work so far... How can I fix this?
I tried that and it didn't work but I found the answer. I just had to reset the developer's path:
$ sudo xcode-select --reset
Now everything is normal
Mostly this error occurs when you have installed a newer version of xcode. And the command line tools are yet to be initialized.
To resolve this:
Go under Xcode Preferences > Locations (tab) > And the bottom options is Command Line Tools. Please select the Xcode version for tools.
Example (For Xcode 10.0 (10A255) ):
Go under Xcode Preferences > Locations (tab) > And the bottom options is Command Line Tools. Select Xcode 10.0 (10A255).
For more details please see this image:
In my case, I had uninstalled Xcode and then issues with git cli started. I solved the problem running the following commands:
$ sudo xcode-select -r
$ sudo xcode-select --switch /Library/Developer/CommandLineTools
and then validating new path with:
$ sudo xcode-select -p
I have faced the same issue as I have uninstalled the XCode abruptly, running the below command (from Terminal) helped me to resolve this.
sudo xcode-select -switch /
This error coming because xcode get deleted, corrupt or moved.
In my case i removed xcode from my Mac and faced the same issue.
I fixed it by simple two steps
Open Terminal
Simply run following command
sudo xcode-select -r
And now error has resolved. Hope it will helpful.
Use this:
sudo xcode-select -switch /
This should solve the problem.
How about what the error suggests? Did you try that?
xcode-select --switch /Applications/Xcode.app
That should do the trick.
For me it helps to install Xcode CLI
xcode-select --install
after uninstalling XCode (I don't develop for the OSx or iOS)
Then I could successfully build downloaded source with make
Try error suggestion :
sudo xcode-select --switch /Applications/Xcode.app
And Then test Git Executable Path.
I had the same problem and had to remove completely Developer tools, and reinstall:
$ rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
Tip: because Xcode had been improperly uninstalled, I had to manually (re)move the Xcode app, too:
$ mv /Applications/Xcode.app/ /Applications/Xcode.app.bak
In my case such error occurred after I has tried to symbolicate crash report, and according to a manual, entered command export DEVELOPER_DIR=”/Applications/Xcode.app/Contents/Developer”
I tried some proposed here solutions but nothing helped.
Then I realized that I have added an environment variable DEVELOPER_DIR to my terminal and this led to error: "xcrun: error: missing DEVELOPER_DIR path:"
Then I've just reboot my terminal, that cleaned the environment variable and the error disappeared.
(FYI: environment variables may be checked with printenv command in terminal)
for my mbp m1 apple sillicon for the case alr tried all the above answer and not solved.
i have solved by here discussion https://developer.apple.com/forums/thread/660641
there is have 2 option to solve, my case...
i have uninstalled xcode because i don't need again
install standalone mode, doesnt work. can't install the software
solved by try download manual command line tools check on the discussion thread for the link file ( 741.5 MB ) .

How to update Xcode from command line

I am trying to update Xcode from the command line. Initially I tried running:
xcode-select --install
which resulted in this message:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
So the question remains, is there a way to update Xcode from the command line?
What you are actually using is the command to install the Xcode command line tools - xcode-select --install. Hence the error message you got - the tools are already installed.
The command you need to update Xcode is softwareupdate command [args ...]. You can use softwareupdate --list to see what's available and then softwareupdate --install -a to install all updates or softwareupdate --install <product name> to install just the Xcode update (if available). You can get the name from the list command.
As it was mentioned in the comments here is the man page for the softwareupdate tool.
2019 Update
A lot of users are experiencing problems where softwareupdate --install -a will in fact not update to the newest version of Xcode. The cause for this is more than likely a pending macOS update (as #brianlmerritt pointed out below). In most cases updating macOS first will solve the problem and allow Xcode to be updated as well.
Updating the Xcode Command Line Tools
A large portion of users are landing on this answer in an attempt to update the Xcode Command Line Tools. The easiest way to achieve this is by removing the old version of the tools, and installing the new one.
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
A popup will appear and guide you through the rest of the process.
I had the same issue and I solved by doing the following:
removing the old tools ($ sudo rm -rf /Library/Developer/CommandLineTools)
install xcode command line tools again ($ xcode-select --install).
After these steps you will see a pop to install the new version of the tools.
I encountered the same issue when I uninstalled the complete version of Xcode to reinstall the CLI version. My fix was:
sudo xcode-select -s /Library/Developer/CommandLineTools
After installing Command Line Tools (with xcode-select --install), type:
sudo xcode-select --switch /Library/Developer/CommandLineTools/
You should be able to run git now:
10:29 $ git --version
git version 2.17.2 (Apple Git-113)
I got this error after deleting Xcode. I fixed it by resetting the command line tools path with sudo xcode-select -r.
Before:
navin#Radiant ~$ /usr/bin/clang
xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist
Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
See `man xcode-select` for more details.
navin#Radiant ~$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
After:
navin#Radiant ~$ /usr/bin/clang
clang: error: no input files
Just type the commands
cd /Library/Developer/CommandLineTools/Packages/;
open macOS_SDK_headers_for_macOS_10.14.pkg
Reference: https://forums.developer.apple.com/thread/104296
$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
I was facing the same problem, resolved it by using the following command.
sudo xcode-select -s /Library/Developer/CommandLineTools
After running the above command then xcode-select -p command showed the following.
/Library/Developer/CommandLineTools
#Vel Genov's answer is correct, except when the version of Xcode can't be updated because it is the latest version for your current version of Mac OS. If you know there is a newer Xcode (for example, it won't load an app onto a device with a recent version of iOS) then it's necessary to first upgrade Mac OS.
Further note for those like me with old Mac Pro 5.1. Upgrading to Mojave required installing the metal gpu (Sapphire AMD Radeon RX 560 in my case) but make sure only HDMI monitor is installed (not 4K! 1080 only). Only then did install Mojave say firmware update required and shut computer down. Long 2 minute power button hold and it all upgraded fine after that!
Catalina update - softwareupdate --install -a won't upgrade xcode from command line if there is a pending update (say you selected update xcode overnight)
I am not sure why this was so tricky for me.
sudo xcode-select --install
Did nothing for me.
softwareupdate --all --install --force
Did nothing for me.
I had to do things in the following order
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
This installed a newer xcode, but not latest.
Then I did
softwareupdate --all --install --force
and they updated completely.
Xcode::Install is a simple cli software that allow you to install/select a specific Xcode version.
You can install it using gem install xcode-install
Then you will be able to install a specific version with xcversion install 9.4.1
And if you have more than one version installed, you can switch version with xcversion select 9.4
You can find more information at https://github.com/KrauseFx/xcode-install
I am now running OS Big Sur. xcode-select --install, and sudo xcode-select --reset did not resolve my issue, neither did the recommended subsequent softwareupdate --install -a command. For good measure, I tried the recommended download from Apple Downloads, but the Command Line Tools downloads available there are not compatible with my OS.
I upvoted the fix that resolved for me, sudo xcode-select --switch /Library/Developer/CommandLineTools/ and added this post for environment context.
I was able to update via CLI using:
softwareupdate --list --verbose
and then
softwareupdate -i Command\ Line\ Tools\ for\ Xcode-13.2
I was trying to use the React-Native Expo app with create-react-native-app but for some reason it would launch my simulator and just hang without loading the app. The above answer by ipinak above reset the Xcode CLI tools because attempting to update to most recent Xcode CLI was not working. the two commands are:
rm -rf /Library/Developer/CommandLineTools
xcode-select --install
This process take time because of the download.
I am leaving this here for any other would be searches for this specific React-Native Expo fix.
I was faced with this today after an update from Xcode (App Store on Mac) updated my Xcode.
My SourceTree wouldn't allow me to do a merge conflict.
In Xcode I found that Command Tools was NOT selected.
I selected it, however still no dice as I was getting the same message of:
I performed the command:
softwareupdate --list
which gave me a list of products, including THREE (3) versions of CommandLine Tools
Software Update Tool
Finding available software
Software Update found the following new or updated software:
Label: Command Line Tools for Xcode-13.2
Title: Command Line Tools for Xcode, Version: 13.2, Size: 577329K, Recommended: YES,
Label: SFSymbolsAuto-3.3
Title: SF Symbols, Version: 3.3, Size: 169368K, Recommended: YES,
Label: Command Line Tools for Xcode-13.3
Title: Command Line Tools for Xcode, Version: 13.3, Size: 718145K, Recommended: YES,
Label: Command Line Tools for Xcode-13.4
Title: Command Line Tools for Xcode, Version: 13.4, Size: 705462K, Recommended: YES,
my version of Xcode is 13.4, so I preceded to try to update just the one.
I used the Label, with escaped spaces (which also works with just quoted label btw "Command Line Tools for Xcode-13.4"
softwareupdate -i Command\ Line\ Tools\ for\ Xcode-13.4
In doing so, ALL 3 updates of Command Line Tools disappeared and I was able to continue.
Hope this helps someone else out there.
Hello I solved it like this:
Install Application> Xcode.app> Contents> Resources> Packages> XcodeSystemResources.pkg.
I arrived here trying to install Appium. Adding my answer in case other folks land here for the same issue.
appium-doctor --ios
... bunch of stuff...
WARN AppiumDoctor ✖ Error running xcrun simctl
... bunch of stuff...
info AppiumDoctor ### Manual Fixes Needed ###
info AppiumDoctor The configuration cannot be automatically fixed, please do the
following first:
WARN AppiumDoctor ➜ Manually install Xcode, and make sure 'xcode-select -p' command shows proper path like '/Applications/Xcode.app/Contents/Developer'
In my case
xcode-select -p
/Library/Developer/CommandLineTools
which appeared wrong...but I knew I had recently updated Xcode and the command line tools
so...
sudo xcode-select -r (sudo required)
then...
xcode-select -p
/Applications/Xcode.app/Contents/Developer
After this, no warning. Appium-doctor returned clean.
xCode version 11.2.1 is necessary for building app in iPad 13.2.3, When I directly try to upgrade from xcode 11.1 to 11.2.1 through App Store it get struck, So after some research , I found a solution to upgrade by removing the existing xcode from the system
So here I am adding the steps to upgrade after uninstalling existing xcode.
Go to Applications and identify Xcode and drag it to trash.
Empty trash to permenently delete Xcode.
Now go to ~/Library/Developer/ folder and remove the contents completely Use sudo rm -rf ~/Library/Developer/ to avoid any
permission issue while deleting
Lastly remove any cache directory associated with xcode in the path ~/Library/Caches/com.apple.dt.Xcode sudo rm -rf
~/Library/Caches/com.apple.dt.Xcode/*
After completing the above steps you can easly install xcode from App Store, which will install the current latest version of xcode
Note: Please take a backup of your existing projects before making the above changes
Update with this one-liner.
softwareupdate --install -a
This reminds me why I hate MacOS. Every time I tried one of these errors I would get the incomprehensible error: No install could be requested (perhaps no UI is present)
Turns out this "CLI" actually needs a graphical session to run. WTF! Very useful when you're actually only ever connecting to the remote mac server over SSH to queue iOS builds.
So the answer for me was:
Physically travel to the Mac, attach screen, mouse and keyboard, and run the command there.
To those having this issue after update to Catalina, just execute this command on your terminal
sudo rm -rf /Library/Developer/CommandLineTools; xcode-select --install;

"xcrun: error: active developer path… does not exist, use xcode-select --switch" when trying to run git. How to fix?

I have been trying to instal the Git on my mac, But every time I use the command $git --version.
I get the following error
xcrun: error: active developer path ("/Volumes/Xcode/Xcode.app/Contents/Developer") does not exist, use xcode-select --switch path/to/Xcode.app to specify the Xcode that you wish to use for command line developer tools (or see man xcode-select)
I have already installed the Xcode on my mac for iOS App development.
I am not sure what this error is trying to say.
My case:
I removed XCode. JetBrains integration with git - breaks. Found this error in terminal.
My soltuion:
I don't want to download XCode to restore PyCharm. So I ran:
sudo xcode-select --reset
So from discussion in the comments above, it seems the right fix here is just to run the command /usr/bin/xcode-select -switch once (i.e., run it with the full path to the executable, rather than just as xcode-select) with /Applications/Xcode.app/Contents/Developer/ as the argument:
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer
After running that once, everything should work as expected from then on.
sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
and reboot your computer.
Try this below answer. It's worked for me.
Open your Xcode Preferences,
--> Select Locations
--> Select your specific Xcode version in Command Line Tools
It was easier for me to let Xcode pick the install location of Command Line Tools for me, instead of the other way around. After downloading the .xip file from the Apple Developer downloads page, expanding the compressed contents, and installing Xcode.App, I was able to open it using Spotlight.
And open preferences:
And select my Command Line Tools under "Locations".
You can install git via the brew package manager for Mac. I recommend installing software this way since it's a great way to manage your installed packages in one place. For example, you can do brew update to get a list of the latest package updates, or brew upgrade to upgrade all of your software installed through brew.
To install brew, open a terminal window and run:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Update your brew packages with brew update
Install git with brew install git
I had installed git, then returned to a terminal window open prior to the installation. I try running command git --version and this raised error message below. To resolve, I ran command source /etc/profile in same terminal window. BTW, terminal window is inside my Webstorm and my end goal is to git init and setup git for my new reactjs project. Happy coding!
The error:
xcrun: error: active developer path ("/Volumes/Xcode/Xcode.app/Contents/Developer") does not exist, use \`xcode-select --switch path/to/Xcode.app\` to specify the Xcode that you wish to use for command line developer tools (or see \`man xcode-select\`)

Resources