Download cocoapods error

hi, I have a problem when I want to download cocoapods from the terminal I type"Sudo gem install cocoapods" but it gives me Failed to build gem native extension. could you please help me?

Hi @Amirhossein2020 Welcome to the community

I expect spelling counts. Try this exactly.

$ sudo gem install cocoapods

Blessings,
—Mark

hi I type it but it gives me the error

Hmm, try typing it in again and then take a screen shot so we can see the error the command in issuing. And then post it here.

You are not running an anti-virus program on your machine are you?

Blessings,
—Mark

I am using Bitdefender virus scanner

You might need to disable the anti-virus software in order to install cocapods.

hello I delete my anti-virus but it gives me that error too

Is your Mac running 10.14.x? If so, you can try and run this first. It allows a “legacy installer” for you to be able to install the headers in the “old location”.

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
  -target /

Blessings,
—Mark

hello I type this but it says invalid target or an invalid option

OK this is a long shot but you might try repairing disk permissions.
Open Disk Utilities and select First Aid. Let that run (it might take a while) and then try installing cocoapods again.

are you the administrator? you might want to make sure you have admin rights when you want to install cocoapods

but from what i remember ios comes pre installed cocoapods (the new ones)

If he didn’t have Admin rights then sudo itself would have failed. Sudo assumes root privileges and you need to have the root password which you can configure when you initially set up your Mac.

hello I try that but it didn’t work too I don’t know what should I do

@Amirhossein2020
Another suggestion.
Create another user on your Mac and ensure that they have Administrator rights.
Log in as that user and try to install cocoapods.

hello I do that but it gives me that error too what should I do now?

hello code crew finally I installed cocoapods I found my problem I should update my ruby then I try to download cocoapods, it download thanks for your help .

How do you update ruby?