Cannot install Cocoapods, keep getting error - swift

I have been trying to install cocoapods but I keep getting an error. I have tried the following commands and get the same result.
sudo gem install cocoapods
sudo gem install -n /usr/local/bin cocoapods
Building native extensions. This could take a while...
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20200726-37338-rvqxhv.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/include/ruby.h
You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/ffi-1.13.1/gem_make.out

After a lot of searching I finally came across a solution that I believe works. If you are use Mac OS Catalina you need to use Brew.
Open Terminal on your Mac.
Now, run
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
Install cocoapods using brew
brew install cocoapods
cocoapods is ready to use now!

Related

cocoapods intallation Errors in mac for flutter doctor

I install Homebrew.
Then I run command
"brew install cocoapods". It install successfully
but in flutter doctor i got error: cocoapods installed but not working properly. Error because of ruby incompatible version.
Tried another method
"sudo gem install cocoapods"
and got error:
While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory.
This is m1 pro 2020 machine.
For MAC M1 chip Users try this solution
install ffi first (if not) In regular terminal using command: sudo arch -x86_64 gem install ffi then arch -x86_64 pod install --repo-update
Run flutter clean
Once complete, rebuild your Flutter application: flutter run
Try to avoid linking with system ruby and download a new ruby version using brew:
brew install ruby
Then add this line to .bash_profile or .zshrc
export PATH=/usr/local/opt/ruby/bin:$PATH
Close the terminal and open it again, then run this line to make sure the default ruby is the newly installed:
which ruby
Uninstall gem cocoapods and download it using brew
brew install cocoapods

How can I solve this error and install cocoapods?

In my terminal I use:
sudo gem install cocoapods
My terminal gives the error shown below. How can I solve this? I have tried a few variations and I cannot get it to work.
Building native extensions. This could take a while...
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.12.2/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20200518-1427-ajbhbt.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/include/ruby.h
You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.12.2 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/ffi-1.12.2/gem_make.out
Agree with Vinayaka and Bryan you're missing some ruby header files and it looks like they're required. Not sure about your environment setup but it may help to just reinstall the latest Xcode from scratch.
Also, I've had some recent problems with Cocoapods installed via terminal. The terminal installs the latest build of Cocoapods. If you're looking for something stable then maybe try the Cocoapods app. It's clunky and it can't read pod files from the latest version of Cocoapods (so you'll have to regenerate any existing podfiles) but its easier to work with especially for those who prefer a graphical environment.
We need to install Xcode's developer tools. The easiest way to do this is through terminal .
xcode-select --install
Later, if there are any write permission issues, use the below code.
sudo gem install cocoapods -n /usr/local/bin/..
P.S: -n specifies the directory where binaries are located.
Please try with
brew install cocoapods

Tesseract on OSX: dyld: Library not loaded: /usr/local/lib/libtiff.5.dylib

I just installed tesseract locally on my mac and installed Leptonia . Xaamp use as utility server .
I have the following problem , when you launch the command tesseract from terminal all is successful, however, if the launch tesseract command from php script gives me this error :
dyld: Library not loaded: /usr/local/lib/libtiff.5.dylib
Referenced from: /usr/local/opt/leptonica/lib/liblept.4.dylib
Reason: Incompatible library version: liblept.4.dylib requires version 8.0.0 or later, but libtiff.5.dylib provides version 6.0.0
can someone help me? thank you
I have a problem similar, but not the same. You can try this:
brew install tesseract
If you Could not symlink, /usr/local/bin is not writable, use this command:
sudo chown -R $(whoami) /usr/local
After that install the autoconf, automake, and libtool with this command:
brew install autoconf automake libtool
I think you will need use this one as well: brew install leptonica --with-libtiff
Finally use the link command to link all libs: brew link tesseract, brew link automake, brew link libtool, etc...
I hope it helps you.
I did this and it helped me with a similar problem.
https://sourceforge.net/p/vietocr/discussion/833570/thread/e1eec2b14b/#e296
I went to /usr/local/opt/tesseract/lib/. I had libtesseract.5.dylib and created a symlink with following command: sudo ln -s libtesseract.5.dylib libtesseract.4.dylib

How to install cocoa pods in terminal?

I read cocoa pods documents and many times try to installed but always fail to installed because in starting steps i found one error so i can't install gems first. can anyone give me steps one by one? how to install or demo.
this is one link which i try.
http://www.raywenderlich.com/12139/introduction-to-cocoapods
OUTPUT in terminal
$ sudo gem install cocoapods
or i try
$ sudo gem install cocoapods -V
ERROR: While executing gem ... (TypeError)
nil can't be coerced into Fixnum
Thanks
Just try this before install cocoa pods
$ sudo gem update —system
then use this commond
$ sudo gem install cocoapods
Hope this will solved your issue.
Seems like an issue with your Ruby installation. You're running 1.8.7(mentioned in comment) which has been retired: https://www.ruby-lang.org/en/news/2013/06/30/we-retire-1-8-7/
Update Ruby(see https://www.ruby-lang.org/en/) and then run:
sudo gem update --system
sudo gem install cocoapods

Bundle install is throwing error when installing coffee-script-source -v '1.6.3'

I'm using Ruby 2.0.0 and Rails 4 but I'm getting an error with coffee-script when I generate new rails project
Installing coffee-script-source (1.6.3)
Errno::EACCES: Permission denied - /usr/local/rvm/gems/ruby-2.0.0-p247/build_info/coffee-script-source-1.6.3.info
An error occurred while installing coffee-script-source (1.6.3), and Bundler cannot continue.
Make sure that gem install coffee-script-source -v '1.6.3' succeeds before bundling.
I just ran into the same problem. Run
sudo bundle update
inside your new site directory. Ruby will then have no trouble installing whatever packages it needs to.
I has the same issue and came across your post when I googled it. I had to run:
sudo gem install turbolinks -v '1.3.0'
sudo gem install uglifier -v '2.2.1'
sudo gem install multi_json -v '1.8.2'
before I could get the bundle install to complete. However, if you are reading the rails tutorial (http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec-rubygems), it says not to worry if that stage fails, as the railsgem file is updated and you manually run:
bundle update
bundle install
Hope this is of some help.
do once: sudo rails new demo
and then for other projects just rails new project_name