(apologizes: not a native english)
I upgraded my MacBook Air a few days ago to OS High-sierra and I encounter a lot of problems with my ruby versions.
In particular:
rbenv
folder…rbenv
knows only 2.3.0 and 2.3.1 ruby versions…rbenv
(see below)…rbenv global 2.3.1
doesn't help at all (nothing changes)…What could I try to use only the 2.3.1
ruby version?………
Some (maybe) helpfull information:
I don't have a ~/.rvm
folder.
Some feedbacks about config, in Terminal:
$> ruby -v
# => ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin17]
$> rbenv versions
# =>
* system (set by /Users/philippeperret/.rbenv/version)
2.3.0
2.3.1
$> which -a ruby
# =>
/Users/philippeperret/.rbenv/shims/ruby
/usr/local/bin/ruby
/usr/bin/ruby
$> irb
irb> RUBY_VERSION
# => "2.4.2"
About homebrew
$> brew config
HOMEBREW_VERSION: 1.4.1
ORIGIN: https://github.com/Homebrew/brew
...
HOMEBREW_PREFIX: /usr/local
CPU: quad-core 64-bit haswell
Homebrew Ruby: 2.3.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 9.0 build 900
Git: 2.14.3 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
...
Ruby: /Users/philippeperret/.rbenv/shims/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Java: 1.8.0_45
macOS: 10.13.2-x86_64
Xcode: 9.2
CLT: N/A
X11: 2.7.11 => /opt/X11
I can't figure out why the ruby version 2.3 (.3) is in /System/Library/Frameworks/Ruby.framework/Versions/
rather than in .rbenv
folder?… (despite the fact that I know it's a high-sierra installation)
When I run a local (rails-like) web app (in my browser), asking it the ruby version:
$> RUBY_VERSION
# => 2.3.3
$> ruby --version
# => ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
$> which -a ruby
# => /usr/bin/ruby
And it can't find some ruby gems (require 'rubygems'
doesn't help). I can't install these gems, of course, until I can't choose 2.3.3
version with rbenv
in Terminal:
When I run:
$> rbenv global 2.4.2p198
… (which is the Terminal ruby version), it complains:
rbenv: version `2.4.2p198' not installed
When I try:
rbenv install 2.4.2p198
… it complains:
ruby-build: definition not found: 2.4.2p198
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
(of course I "brew updated" and so on)
I spent the last few days to read documentation and SO's question/answers in vain…
Without any answer, the only way I found was to remove all ruby versions:
> brew remove --force ruby
> brew uninstall --ignore-dependencies ruby
> brew uninstall --force ruby
> sudo rm -rf /usr/local/lib/ruby
> sudo rm -rf ~/.rbenv
> sudo rm -rf ~/.gem
Now I use 2.3.3
version everywhere.
> ruby -v
# => 2.3.3
In brew config
:
Homebrew Ruby: 2.3.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
I can find my gems in /Library/Ruby/Gems/2.3.0/gems
:
gem which sass
# => /Library/Ruby/Gems/2.3.0/gems/sass-3.5.4/lib/sass.rb
To install a new gem, super user privileges are required:
sudo gem install <gem name>
Thanks for help. Maybe It helps.