Cannot change any gemset by rvm on macOS Catalina 10.15.4 (19E287)
Default gemset is always selected no matter what I change to other gemset
rvm --version
rvm 1.29.10 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
rvm list
=* ruby-2.3.1 [ x86_64 ]
# => - current
# =* - current && default
# * - default
ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin19]
cat ~/.profile
export PATH=$PATH:/Library/PostgreSQL/10/bin
export PATH="$PATH:$HOME/.rvm/bin"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
rvm gemsset list
gemsets for ruby-2.3.1 (found in /Users/username/.rvm/gems/ruby-2.3.1)
=> (default)
global
gemset1
gemset2
rvm gemset use gemset1
Using ruby-2.3.1 with gemset default
Or rvm gemset use ruby-2.3.1#gemset1
Using ruby-2.3.1 with gemset default
echo $PATH
/Users/username/.rvm/gems/ruby-2.3.1/bin:/Users/username/.rvm/rubies/ruby-2.3.1/bin:/Users/username/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/PostgreSQL/10/bin
echo $GEM_HOME
/Users/username/.rvm/gems/ruby-2.3.1
echo $GEM_PATH
/Users/username/.rvm/gems/ruby-2.3.1
gem env
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.8
- RUBY VERSION: 2.3.1 (2016-04-26 patchlevel 112) [x86_64-darwin19]
- INSTALLATION DIRECTORY: /Users/username/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/username/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /Users/username/.rvm/rubies/ruby-2.3.1/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /Users/username/.rvm/rubies/ruby-2.3.1/bin
- SPEC CACHE DIRECTORY: /Users/username/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/username/.rvm/rubies/ruby-2.3.1/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-19
- GEM PATHS:
- /Users/username/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/username/.rvm/gems/ruby-2.3.1/bin
- /Users/username/.rvm/rubies/ruby-2.3.1/bin
- /Users/username/.rvm/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /Library/PostgreSQL/10/bin
which rake
/Users/username/.rvm/rubies/ruby-2.3.1/bin/rake
Special thanks for anyone can help me on this case!
Try either using rvm gemset use gemset1 or rvm use ruby-2.3.1#gemset1.
Related
I am trying to create a rails app and fails like so:
$ rails new blog
Rails 6 requires Ruby 2.5.0 or newer.
You're running:
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
Please upgrade to Ruby 2.5.0 or newer to continue.
However, my ruby version is 2.6.3 according to my system:
$ ruby --version
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin18]
$ which ruby
/Users/flaab/.rbenv/shims/ruby
Rbenv has 2.6.5 activated.
$ rbenv versions
system
* 2.6.5 (set by /Users/flaab/.ruby-version)
mruby-dev
But it recognizes the wrong one as well.
$ which -a ruby
/Users/flaab/.rbenv/shims/ruby
/usr/bin/ruby
My gem env is...
flaab#MBP-de-Arturo ~ $ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.3
- RUBY VERSION: 2.6.5 (2019-10-01 patchlevel 114) [x86_64-darwin18]
- INSTALLATION DIRECTORY: /Users/flaab/.gem
- USER INSTALLATION DIRECTORY: /Users/flaab/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /Users/flaab/.rbenv/versions/2.6.5/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /Users/flaab/.gem/bin
- SPEC CACHE DIRECTORY: /Users/flaab/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/flaab/.rbenv/versions/2.6.5/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-18
- GEM PATHS:
- /Users/flaab/.gem
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "echo \"gem" => "--no-document\" > ~/.gemrc"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/flaab/.rbenv/versions/2.6.5/bin
- /opt/local/libexec/rbenv
- /Users/flaab/.rbenv/shims
- /usr/local/bin
- /opt/local/bin
- /opt/local/sbin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /Users/flaab/bin
- /Users/flaab/.rbenv/shims
- /sw/bin
- /Users/flaab/.local/lib/npm/bin
- /Users/flaab/.composer/vendor/bin
How can I instruct gem to use the 2.6.5 version of ruby mentioned above?
Thanks in advance
To no avail. Ditched mac and went back to developing on debian. No issues.
Either run rbenv global 2.5.0 to set your global ruby or create a .ruby-version file in the app directory to instruct rbenv to use a specific version.
echo "2.5.0" >> .ruby-version and then try again.
Documentation
Do you have this already added to your .bash_profile ?
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
If not add the above lines to the bottom of the file, then close and restart your terminal(s).
It looks like your EXECUTABLE DIRECTORY may not be set correctly. Try the following command:
rbenv shell 2.6.5
Also, make sure you're in a new empty directory and do
rbenv local 2.6.5
Then try rails command again
rails new blog
So I'm switching to a project that is using ruby. They use asdf as a package manager
I’m having trouble installing the gems, I’m using zsh and I’m thinking there might be an issue with the paths
Running gem install bundler outputs: You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
ruby -v
outputs: ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
which ruby
output: /usr/bin/ruby
And I tried setting a global version for ruby with asdf global ruby 2.5.3 but that doesn’t seem to change the version
This is my gem environment:
RubyGems Environment:
- RUBYGEMS VERSION: 2.5.2.3
- RUBY VERSION: 2.3.7 (2018-03-28 patchlevel 456) [universal.x86_64-darwin18]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/carlos.grijalva/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /Users/carlos.grijalva/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-18
- GEM PATHS:
- /Library/Ruby/Gems/2.3.0
- /Users/carlos.grijalva/.gem/ruby/2.3.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/carlos.grijalva/.asdf/shims
- /Users/carlos.grijalva/.asdf/bin
- /Users/carlos.grijalva/bin
- /usr/local/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
It sounds like you may need to add the relevant lines to your .zshrc so asdf shims get recognized. You can find the instructions here
For macOS & zsh the correct lines to append to .zshrc are:
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.zshrc
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.zshrc
After doing so, either source ~/.zshrc or restart your terminal
This is the situation: I am running mac OS Mojave 10.14.3 - It seems system is running ruby v2.3.0 and installed homebrew ruby 2.6.x when I try to run sass I get the following error:
> Sass is watching for changes. Press Ctrl-C to stop.
Gem::MissingSpecError: Could not find 'ffi' (>= 0.5.0, < 2) among 20 total gem(s)
Checked in 'GEM_PATH=/Users/samuellarcher/.gem/ruby/2.3.0:/Library/Ruby/Gems/2.3.0:/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0', execute `gem env` for more information
Running gem env returns:
> RubyGems Environment:
- RUBYGEMS VERSION: 3.0.3
- RUBY VERSION: 2.6.2 (2019-03-13 patchlevel 47) [x86_64-darwin18]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.6.0
- USER INSTALLATION DIRECTORY: /Users/samuellarcher/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/2.6.0/bin
- SPEC CACHE DIRECTORY: /Users/samuellarcher/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.6.2/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-18
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.6.0
- /Users/samuellarcher/.gem/ruby/2.6.0
- /usr/local/Cellar/ruby/2.6.2/lib/ruby/gems/2.6.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/opt/ruby/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
Now, when i do a:
whereis ruby
it returns:
/usr/bin/ruby
and
echo $PATH
returns
/usr/local/opt/ruby/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
on top of that, the path priority under /private/etc/paths is set to:
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
which seems correct to me. The .bash_profile file contains:
export PATH="/usr/local/opt/ruby/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/ruby/lib"
export CPPFLAGS="-I/usr/local/opt/ruby/include"
Checking gem directories:
ls /usr/local/lib/ruby/gems/2.6.0/gems/
returns
ffi-1.10.0 rb-fsevent-0.10.3 rb-inotify-0.10.0 sass-3.7.3 sass-listen-4.0.0 test-unit-3.3.0
with the missing ffi gem we are after.
ls .gem/ruby/2.3.0/cache/
returns
CFPropertyList-3.0.0.gem faraday-cookie_jar-0.0.6.gem mini_magick-4.5.1.gem simctl-1.6.5.gem
addressable-2.6.0.gem faraday_middleware-0.13.1.gem multi_json-1.13.1.gem slack-notifier-2.3.2.gem
atomos-0.1.3.gem fastimage-2.1.5.gem multi_xml-0.6.0.gem terminal-notifier-1.8.0.gem
babosa-1.0.2.gem fastlane-2.117.1.gem multipart-post-2.0.0.gem terminal-table-1.8.0.gem
bundler-2.0.1.gem gh_inspector-1.1.3.gem nanaimo-0.2.6.gem tty-cursor-0.6.1.gem
claide-1.0.2.gem google-api-client-0.23.9.gem naturally-2.2.0.gem tty-screen-0.6.5.gem
colored-1.2.gem google-cloud-core-1.3.0.gem os-1.0.0.gem tty-spinner-0.9.0.gem
colored2-3.1.2.gem google-cloud-env-1.0.5.gem plist-3.5.0.gem uber-0.1.0.gem
commander-fastlane-4.4.6.gem google-cloud-storage-1.16.0.gem public_suffix-2.0.5.gem unf-0.1.4.gem
declarative-0.0.10.gem googleauth-0.6.7.gem representable-3.0.4.gem unf_ext-0.0.7.5.gem
declarative-option-0.1.0.gem highline-1.7.10.gem retriable-3.1.2.gem unicode-display_width-1.5.0.gem
digest-crc-0.4.1.gem http-cookie-1.0.3.gem rouge-2.0.7.gem word_wrap-1.0.0.gem
domain_name-0.5.20180417.gem httpclient-2.8.3.gem rubygems-update-3.0.2.gem xcode-install-2.3.0.gem
dotenv-2.7.1.gem jwt-2.1.0.gem rubygems-update-3.0.3.gem xcodeproj-1.8.1.gem
emoji_regex-1.0.1.gem memoist-0.16.0.gem rubyzip-1.2.2.gem xcpretty-0.3.0.gem
excon-0.62.0.gem mime-types-3.2.2.gem security-0.1.3.gem xcpretty-travis-formatter-1.0.0.gem
faraday-0.15.4.gem mime-types-data-3.2018.0812.gem signet-0.11.0.gem
without the missing ffi gem
I might miss something fundemental but ideally I would like the homebrew ruby version 2.6.x running when I run sass - so where from here?
As per M. Zinovski's suggestion I uninstalled homebrew ruby and installed rbenv via homebrew. I followed instructions added
eval "$(rbenv init -)"
to .bash_profile - check installation seems fine.
SamuelserBook15:~ samuellarcher$ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
Checking for `rbenv' in PATH: /usr/local/bin/rbenv
Checking for rbenv shims in PATH: OK
Checking `rbenv install' support: /usr/local/bin/rbenv-install (ruby-build 20190314)
Counting installed Ruby versions: 2 versions
Checking RubyGems settings: OK
Auditing installed plugins: OK
Local and global version set to newly installed rbenv 2.6.2
samuellarcher$ rbenv version
2.6.2 (set by /Users/samuellarcher/.ruby-version)
samuellarcher$ ruby -v
ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-darwin18]
However - when I ran sass - same old error - still referencing to 2.3.0 and ffi gem missing. So... absolutely min-bobbeling .. 2.6.2 is running why is it still pointing to 2.3.0 gem files???
Centos 7
I have installed ruby 2.1.2 and rubygems but when I run rubygems --version I get the error rubygems: command not found.
My $PATH is /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/lib/ruby/gems/2.1.0:/root/.gem/ruby/2.1.0
gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.11
- RUBY VERSION: 2.1.2 (2014-05-08 patchlevel 95) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.1.0
- USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.1.0
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /root/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.1.0
- /root/.gem/ruby/2.1.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/sbin
- /usr/local/bin
- /sbin
- /bin
- /usr/sbin
- /usr/bin
- /root/bin
- /root/ruby-2.1.2
- /usr/bin/gem
yum list installed shows rubygems.noarch
What do I need to do to get rubygems working?
To install ruby and rubygems on centOS, Run on Terminal
sudo yum install ruby
sudo yum install rubygems
To check version of of ruby and rubygems, Run
ruby -v
gem -v
Note: gem --version is same as gem -v
Update the gems list using :
sudo gem update
sudo gem update --system
Now, you can install any gem, using command
gem install <gem_name>
For instance, To install rails on centOS, Run
sudo gem install rails
I'm using Arch Linux with Zsh.
I installed RVM follow the official document :
$ curl -L https://get.rvm.io | bash -s stable --ruby
$ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.zshrc
$ source ~/.zshrc
$ rvm use 1.9.2 --default
After installed RVM. Every gem I installed show me the Gem::LoadError error like this :
$ gem install huami
$ huami
/home/meck/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find huami (>= 0) amongst [] (Gem::LoadError)
from /home/meck/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/meck/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
from /home/meck/.gem/ruby/1.9.1/bin/huami:22:in `<main>'
And gem list is empty :
$ gem list
*** LOCAL GEMS ***
This is my gem env :
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.2 (2012-04-20 patchlevel 320) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/meck/.rvm/gems/ruby-1.9.2-p320#global
- RUBY EXECUTABLE: /home/meck/.rvm/rubies/ruby-1.9.2-p320/bin/ruby
- EXECUTABLE DIRECTORY: /home/meck/.rvm/gems/ruby-1.9.2-p320#global/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/meck/.rvm/gems/ruby-1.9.2-p320#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://rubygems.org/"]
- "gem" => "--user-install"
- REMOTE SOURCES:
- http://rubygems.org/
Could anybody point out what step did I miss?
RVM doesn't work very will with oh-my-zsh. oh-my-zsh likes to control a lot of your shell experience. Your mileage will vary. Certain extensions will conflict with RVM's operation. Hop in IRC Freenode #rvm if you encounter issues as they can provide direct and quick help with oh-my-zsh.