Cocoapod : warning: URI.escape is obsolete - cocoa

/Users/mike/.rvm/gems/ruby-2.7.0/gems/cocoapods-core-1.9.1/lib/cocoapods-core/cdn_source.rb:337: warning: URI.escape is obsolete

Looks like the upcoming CocoaPods 1.10.0 will remove the deprecation warnings. See https://github.com/CocoaPods/CocoaPods/issues/9491. In the mean time, I wouldn't worry about it. These are just warnings and shouldn't currently cause any issues.
If you really want to remove the warnings you can disable all Ruby warnings using the RUBYOPT environment variable like this:
export RUBYOPT='-W0'
Although I wouldn't recommend it as you risk missing something important in the future.

upgrading ruby to 2.7.2 and reinstall cocoapods 1.10.0 can fix
brew upgrade ruby
gem install cocoapods

Same problems with ruby 2.7.1 and 2.7.2 but SOLVED for me with installing ruby 2.6.6:
if you don't have homebrew installed:
install homebrew: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
install rbenv (version manager): brew install rbenv ruby-build
prepare a terminal: echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile source ~/.bash_profile
install Ruby: rbenv install 2.6.6
activate the version: rbenv global 2.6.6
verify the activated version: ruby -v
then reinstall cocoapods: sudo gem install cocoapods
and in the app folder run:pod install

Try the following:
sudo gem install cocoapods

First, remove old cocoapods:
sudo gem uninstall cocoapods
Then, install it again and override:
brew install cocoapods --build-from-source
brew link --overwrite cocoapods
It worked for me after upgrating to Catalina

Related

How to "recompile Ruby with OpenSSL support" using RVM?

After installing Ruby 2.3.8 via RVM I get the following error when running bundle:
You must recompile Ruby with OpenSSL support or change the sources in your Gemfile
How do I recompile Ruby with OpenSSL support?
My Solution for this:
Just run
1: brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/8c9b113bc6812dc74c598c8f860017e42fba8d78/Formula/openssl.rb
2: rvm install 2.3 --with-openssl-lib=/usr/local/opt/openssl/lib --with-openssl-include=/usr/local/opt/openssl/include
(if rvm is already installed, use reinstall instead of install.)
For rvm on MacOS Mojave
In my case, the installer fails because it is using obsolete parts in the new version of openssl. This has worked for me:
Go to the "homebrew-core" folder and get back the old openssl gem(1.0.2t)
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
git show 8b9d6d688f483a0f33fcfc93d433de501b9c3513:Formula/openssl.rb >> Formula/openssl\#1.0.2t.rb
Enter the file and rename the class "Openssl" to "OpensslAT102t"
brew edit Formula/openssl\#1.0.2t.rb
Install it with brew
brew install openssl#1.0.2t
Once installed, force rvm to use the installed version of ssl
# Install 2.3.8
rvm install 2.3.8 --disable-binary --with-openssl-dir=`brew --prefix openssl#1.0.2t`
# Or reinstall
rvm reinstall 2.3.8 --disable-binary --with-openssl-dir=`brew --prefix openssl#1.0.2t`

Upgraded rbenv and still can't install ruby 2.4.0

I am trying to install ruby 2.4.0 using rbenv.
I am using homebrew.
When I tried the following command:
rbenv install ruby 2.4.0
I get the following:
ruby-build: definition not found: 2.4.0
The following versions contain `2.4.0' in the name:
2.4.0-dev
2.4.0-preview1
rbx-2.4.0
See all available versions with `rbenv install --list'.
If the version you need is missing, try upgrading ruby-build:
brew update && brew upgrade ruby-build
I performed the brew update and brew upgrade ruby-build commands and I still get the same message that ruby-build definition 2.4.0 not found.
How can I install ruby 2.4.0 and fix this problem?
I found that I had to do the following:
brew reinstall ruby-build --HEAD
then I was able to install ruby 2.4.0 using:
rbenv install 2.4.0
I'm guessing that brew upgrade ruby-build --HEAD did not update the latest ruby installations available.
Start by checking Ruby's version through:
ruby -v
If it's not the version you need, make sure you download it from their Official Website.
Then, if you already have Homebrew installed, you can try the following command:
brew install ruby
Otherwise, you can install Homebrew first through this command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

How do I install ruby gems on Mac

How do I install RubyGems on my Mac?
I tried to run $ gem install rubygems-update with no luck . It returns
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
Any help would be great. Thanks
I would highly suggest using a package manager and a Ruby Environment Manager.
On Mac:
brew update
brew install ruby
# If you use bash
echo 'export PATH=/usr/local/Cellar/ruby/2.4.1_1/bin:$PATH' >> ~/.bash_profile
# If you use ZSH:
echo 'export PATH=/usr/local/Cellar/ruby/2.4.1_1/bin:$PATH' >> ~/.zprofile
You can do that but I suggest using an Environment Manager for Ruby.
You have rbenv and RVM.
IMO go for rbenv:
brew install rbenv ruby-build
# bash
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
# zsh
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zprofile
echo 'eval "$(rbenv init -)"' >> ~/.zprofile
# list all available versions:
rbenv install -l
# install a Ruby version:
rbenv install 2.4.1
# set ruby version for a specific dir
rbenv local 2.4.1
# set ruby version globally
rbenv global 2.4.1
rbenv rehash
gem update --system
One more variant is to use brew-gem.
https://formulae.brew.sh/formula/brew-gem
https://github.com/sportngin/brew-gem
Just copy/paste from the documentation:
brew install brew-gem
Usage
brew gem install heroku
To install a specific version: brew gem install heroku 3.8.3
To install using a brew installed ruby(/usr/local/bin/ruby): brew gem install heroku --homebrew-ruby
And with a specific version: brew gem install heroku 3.8.3 --homebrew-ruby
To upgrade: brew gem upgrade heroku
To uninstall: brew gem uninstall heroku
To check information: brew gem info heroku
Note: Installed gems are listed in brew list with prefix of gem-, like gem-heroku.
After installing cocoapods as Tulon suggested the thing which worked for me was passing the --user-install flag to the gem install command e.g
gem install rubygems-update --user-install
from https://guides.cocoapods.org/using/getting-started.html#sudo-less-installation
You may have to install manually in which case (as per the official website):
Go to the official website and download the zip file
Unzip the file in a directory.
Then go to the directory in your terminal and run: ruby setup.rb
It is showing that you don't have the permission to write something in that directory. Instead use this directory :
sudo gem install -n /usr/local/bin cocoapods
It perfectly work for me.
(I am using macOS Sierra, version 10.12.6)

Ruby version not in ruby-build list for rbenv

I'm using Rails 4.2 and wanted to update my Ruby version as well with rbenv.
I used Homebrew to install ruby-build and no matter how many times I try to update via brew, Ruby version 2.1.3 won't show when I run rbenv install --list.
Usually, follow these steps to install a new Ruby version with rbenv:
$ brew update
$ brew upgrade ruby-build
$ brew upgrade rbenv
Check which versions are available after updating:
$ ruby-build --definitions
Install a specific version (for example 2.1.3) with:
$ rbenv install 2.1.3
Or if you are interested into improved support for UTF8 characters in the irb console:
$ RUBY_CONFIGURE_OPTS=--with-readline-dir=`brew --prefix readline` rbenv install 2.1.3
After these steps I usually set the newest version as my global default:
$ rbenv global 2.1.3
If you installed rbenv and ruby-build with homebrew and when you do echo $(rbenv root), you get /usr/local/var/rbenv instead of /Users/<username>/.rbenv, here is how to fix the issue.
When you install rbenv with homebrew, homebrew says:
To use Homebrew's directories rather than ~/.rbenv add to your profile:
export RBENV_ROOT=/usr/local/var/rbenv
Don't do that. Remove that line from your profile. Make sure you refresh your terminal after.
Then remove any signs of rbenv in the /usr/local/var directory:
sudo rm -r /usr/local/var/rbenv
Now when I do echo $(rbenv root) I get /Users/<username>/.rbenv instead of /usr/local/var/rbenv.
That fixed it for me.
The recommended installation from (https://github.com/sstephenson/ruby-build) states that you should install ruby-build as an rbenv plug-in.
I uninstalled ruby-build via Homebrew (brew uninstall ruby-build)
Navigated to ruby-build on my local machine and deleted it
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
Now, when I run rbenv install --list, I see Ruby 2.1.3. A quick installation of: rbenv install 2.1.3 and I am now free to use 2.1.3 where I like. This also worked for my teammate.
Please update by brew upgrade ruby-build and then you should see 2.1.3 in rbenv install --list
You need to update ruby build. After update you can install all current suported versions.
If you using rbenv installed via git use
cd "$(rbenv root)"/plugins/ruby-build && git pull
Or via home brew
$ brew upgrade ruby-build
$ brew upgrade rbenv

OpenSSL error installing ruby 2.0.0-p195 on Mac with rbenv

I'm trying to install Ruby 2.0.0-p195 using rbenv on a Mac (Mountain Lion) and got this error.
BUILD FAILED
Inspect or clean up the working tree at /var/folders/vt/27n8h2yj27v7rzq58075f3_m0000gn/T/ruby-build.20130618163859.1669
Results logged to /var/folders/vt/27n8h2yj27v7rzq58075f3_m0000gn/T/ruby-build.20130618163859.1669.log
Last 10 log lines:
installing default gems: /Users/me/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0 (build_info, cache, doc, gems, specifications)
bigdecimal 1.2.0
io-console 0.4.2
json 1.7.7
minitest 4.3.2
psych 2.0.0
rake 0.9.6
rdoc 4.0.0
test-unit 2.0.0.0
The Ruby openssl extension was not compiled. Missing the OpenSSL lib?
When I ran brew install openssl it said
Warning: openssl-1.0.1e already installed
Following a solution on this thread https://github.com/sstephenson/ruby-build/issues/305 I tried to install latest stable this way and got the same error
env CFLAGS='-g -O2' RUBY_CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline`" rbenv install 2.0.0-p195
Any ideas?
Try adding OpenSSL to the config options using the --with-openssl-dir option:
$ CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-p195
If you're using Homebrew, you'll need to install OpenSSL before running the above by running:
$ brew install openssl
UPDATE (see #JarkkoLaine 's comment below):
Just for the record, you should not need to use the config opts
anymore with ruby-build and homebrew. However, I had to reinstall
openssl with homebrew to make it work: brew uninstall openssl; brew
upgrade; brew install openssl; rbenv install 2.0.0-p247. See this for
more info.
I fixed this by executing:
brew link openssl --force
Mac OSX 10.9.4
Upgrading to the latest version of ruby-build fixed the problem for me:
Like the OP, I got
BUILD FAILED
Inspect or clean up the working tree at /Users/me/.rbenv/sources/2.0.0-p247
Results logged to /var/folders/3x/y_8y8vr53ws_kxj97km79q5h0000gn/T/ruby-build.20130704172404.3106.log
Last 10 log lines:
installing default gems: /Users/me/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0 (build_info, cache, doc, gems, specifications)
bigdecimal 1.2.0
io-console 0.4.2
json 1.7.7
minitest 4.3.2
psych 2.0.0
rake 0.9.6
rdoc 4.0.0
test-unit 2.0.0.0
The Ruby openssl extension was not compiled. Missing the OpenSSL lib?
but installing the latest version of ruby-build, via
# Don't forget brew doctor and brew update if required
brew upgrade ruby-build
fixed it.
Ruby-build had some changes between when the OP asked and now, which would explain why it worked for me, but not for the OP using the latest stable version of ruby-build.
For those who have problems installing openssl.
I had this error on my Mac 10.8.4
brew install openssl
created directory `/usr/local/Cellar/openssl/1.0.1e/include/openssl'
make: *** [install_sw] Error 13
READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting
These open issues may also help:
https://github.com/mxcl/homebrew/pull/19429
Create a directory if it does not exist
sudo mkdir /usr/local/etc/openssl
Change the rights. Replace and with your name and group (e.g. serge:admin)
sudo chown -R <username>:<group> /usr/local/etc/openssl/
Repeat openssl installation
brew install openssl
Install curl-ca-bundle
brew install curl-ca-bundle
install ruby
CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-p195
Bingo
Solution using ruby-install:
After uninstalling and installing openssl a couple of times (probably unnecessary) I successfully tried this:
ruby-install ruby 2.1.3 -- --with-openssl-dir=`brew --prefix openssl`
The missing library is libssl*-dev* / openssl*-dev*, depending your distribution.
This issue came up again for me with Mac OS 10.9.5
Mac upgraded the command-line tools and that upgraded openssl, which broken rbenv.
I tried all of these solutions, but none of them worked. Everything was up-to-date, but I couldn't install any new gems or build rubies.
My solution was to:
Remove the ruby version (for me it was 2.1.1)
Brew uninstall ruby-build and rbenv
Brew Re-install rbenv and ruby-build
Hope this helps you if you encounter it too!

Resources