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)"
Related
I'm trying to install Ruby version 2.7.2 on my Mac (latest OS with all updates) and did the following
brew update
brew upgrade rbenv ruby-build
and then
rbenv install 2.7.2
ruby-build: definition not found: 2.7.2
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
So I tried following the instructions above and get this
brew update && brew upgrade ruby-build
Already up-to-date.
Warning: ruby-build 20200926 already installed
You need to install the latest ruby-build
$ brew unlink ruby-build # remove STABLE version
$ brew install --HEAD ruby-build
$ rbenv install -l | grep '2.7.2'
2.7.2
Only latest stable releases for each Ruby implementation are shown.
Use 'rbenv install --list-all' to show all local versions.
The answer from #andrei-kovrov is correct but, alternatively, you can wait until this PR gets merged:
https://github.com/Homebrew/homebrew-core/pull/62096
Btw, this answer will not age well so, for reference, this is where the formulae are staged before they get released:
https://github.com/Homebrew/homebrew-core/pulls
It might be an issue reading the correct version of ruby based on the path that is specified. If you already have another version of ruby installed the path might not be updated to look for a newer version.
This article has a lot of really great information on how to set up ruby on a mac:
https://stackify.com/install-ruby-on-your-mac-everything-you-need-to-get-going/
/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
I run brew update and brew upgrade rbenv ruby-build. FYI: I updated xcode to version 8.1 yesterday.
I checked available versions, rbenv install -l.
Then I tried to install ruby2.2.5 by rbenv install 2.2.5, then I get the following errors.
I tried 2.3.1 but I got the same errors. How can I fix the problem?
Downloading ruby-2.2.5.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.5.tar.bz2
Installing ruby-2.2.5...
BUILD FAILED (OS X 10.11.6 using ruby-build 20160602)
Inspect or clean up the working tree at /var/folders/2p/49l6q0gs6qzgtxbg4h1st_5h0000gq/T/ruby-build.20161106122840.51330
Results logged to /var/folders/2p/49l6q0gs6qzgtxbg4h1st_5h0000gq/T/ruby-build.20161106122840.51330.log
Last 10 log lines:
Referenced from: /private/var/folders/2p/49l6q0gs6qzgtxbg4h1st_5h0000gq/T/ruby-build.20161106122840.51330/ruby-2.2.5/./miniruby (which was built for Mac OS X 10.12)
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: _clock_gettime
Referenced from: /private/var/folders/2p/49l6q0gs6qzgtxbg4h1st_5h0000gq/T/ruby-build.20161106122840.51330/ruby-2.2.5/./miniruby (which was built for Mac OS X 10.12)
Expected in: /usr/lib/libSystem.B.dylib
make: *** [encdb.h] Trace/BPT trap: 5
make: *** Waiting for unfinished jobs....
make: *** [.rbconfig.time] Trace/BPT trap: 5
First, I've uninstalled all:
brew uninstall rbenv ruby-build
and because of an old sticky ruby-build installation, I've forced like this:
brew uninstall --force ruby-build
I can see an old invocation for rbenv when I type ruby -v. So I remove all rbenv references from $HOME/.bash_profile and then reload it with:
source $HOME/.bash_profile
Now I only see my old default MacOs ruby version:
ruby -v # ruby 2.0.0p481 (2014-05-08 revision 45883)
which ruby # /usr/bin/ruby
¡Good! Now it's time to install them again and then list available Ruby versions:
brew install rbenv
rbenv install -l
I now can see more Ruby options to install...
2.2.4, 2.2.5, 2.2.6, 2.2.7, 2.2.8, 2.2.9, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.5.0
I will choose one of them and make it global:
rbenv install 2.5.0
rbenv global 2.5.0
I case you don't have already the $HOME/.bash_profile rbenv config line, run:
rbenv init
... and add the resulting line to your $HOME/.bash_profile.
I tried to upgrade rbenv.
brew upgrade rbenv
Then I got a warning.
Warning: You have Xcode 8 installed without the CLT;
this causes certain builds to fail on OS X El Capitan (10.11).
Please install the CLT via:
sudo xcode-select --install
Error: rbenv 1.0.0 already installed
So I installed xcode-select.
sudo xcode-select --install
Then I tried to upgrade rbenv but rbenv 1.0.0 was already installed.
brew upgrade rbenv
Error: rbenv 1.0.0 already installed
So I tried to install 2.3.1 and 2.2.5
rbenv install 2.3.1
...
rbenv install 2.2.5
And it was a success.
➜ ~ rbenv versions
system
1.9.3-p327
* 2.2.2 (set by /Users/sokada/.rbenv/version)
2.2.5
2.3.1
I also need to install bundle since I came to this problem from using bundle.
gem install bundler -v 1.13.6 // newest as of this writing
bundler -v
bundler install // finally I could use it.
It's a really old question. However, the correct approach I believe is to upgrade ruby-build. It is available as a plugin for rbenv that provides the rbenv install command.
so to fix the issue follow this approach: https://github.com/rbenv/ruby-build#upgrading
# Via Homebrew
$ brew update && brew upgrade ruby-build
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
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!