DEV Community

Dalitso Kasonde
Dalitso Kasonde

Posted on • Edited on

1

ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension

Solution worked for Mac Big Sur OS

NOTE : replace user_name - with your laptop user name

  1. Check the version of Ruby

    ruby -v

Also check the given path:
which ruby

  1. Use Homebrew to install the latest Ruby

    brew install ruby

Binaries installed by gem will be placed into:

/usr/local/lib/ruby/gems/2.7.0/bin

  1. Add this to your PATH.

If you need to have ruby first in your PATH run:

echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> /Users/user_name/.bash_profile

  1. For compilers to find ruby you may need to set:

export LDFLAGS="-L/usr/local/opt/ruby/lib"
export CPPFLAGS="-I/usr/local/opt/ruby/include"

  1. Follow the below instructions to set PATH. Now you will go to see the installed Ruby.

echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> /Users/user_name/.bash_profile

echo 'export LDFLAGS="-L/usr/local/opt/ruby/lib"' >> ~/.bash_profile

echo 'export CPPFLAGS="-I/usr/local/opt/ruby/include"' >> ~/.bash_profile

source ~/.bash_profile

  1. Finally, Make sure your PATH is in place.

ruby -v

which ruby

  1. Make sure you install by specifying the save destination as follows.

sudo gem install -n /usr/local/bin cocoapods

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (1)

Collapse
 
kanggara75 profile image
Call Vin

Work for me

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay