I tried to update the cocoa pods, but facing an issue while updating(xcode12, macOS Catalina 10.15.5). please help. I have also attached a screenshot of my terminal.
Thanks in advance!!

I tried to update the cocoa pods, but facing an issue while updating(xcode12, macOS Catalina 10.15.5). please help. I have also attached a screenshot of my terminal.
Thanks in advance!!

I solved the above problem by updating the ruby to the latest version(3.0.0) using the following command in the terminal:
Check the version of Ruby installed on your Mac
ruby -v
Install the Ruby Version Manager rvm
curl -L https://get.rvm.io | bash -s stable
Once this command has finished running you need to restart your terminal for rvm to be recognised.
Install the latest version of Ruby
rvm install ruby-[version]
(or)
rvm install ruby --latest
Install cocoapods
sudo gem install cocoapods
pod setup
you need to install Xcode Developer Tools first, as mentioned in your error message.
to install Developer Tools, open a Terminal and execute xcode-select --install command.