I'm on an Ubuntu system and have installed ruby-2.1.3 using rbenv. I have made 2.1.3 global and it is accessible from my system terminal.
System Terminal:
lambda#lambda-PC:~$ ruby -v
ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]
However, when I run the same command in my RubyMine embedded terminal, it asks me to install ruby through the aptitude repository.
lamdba#lambda-PC:~/RubymineProjects/Loccasions$ ruby -v
The program 'ruby' can be found in the following packages:
* ruby
* ruby1.8
Try: sudo apt-get install <selected package>
The same thing goes for "gem environment" and "gem -v".
System Terminal:
lambda#lambda-PC:~$ gem -v
2.4.2
lambda#lambda-PC:~$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.2
- RUBY VERSION: 2.1.3 (2014-09-19 patchlevel 242) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/lambda/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0
- RUBY EXECUTABLE: /home/lambda/.rbenv/versions/2.1.3/bin/ruby
- EXECUTABLE DIRECTORY: /home/lambda/.rbenv/versions/2.1.3/bin
- SPEC CACHE DIRECTORY: /home/lambda/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /home/lambda/.rbenv/versions/2.1.3/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/lambda/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0
- /home/lambda/.gem/ruby/2.1.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/lambda/.rbenv/versions/2.1.3/bin
- /home/lambda/.rbenv/libexec
- /home/lambda/.rbenv/plugins/ruby-build/bin
- /home/lambda/.rbenv/shims
- /home/lambda/.rbenv/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
RubyMine Terminal:
lambda#lambda-PC:~/RubymineProjects/Loccasions$ gem -v
The program 'gem' can be found in the following packages:
* ruby
* rubygems
Try: sudo apt-get install <selected package>
lambda#lambda-PC:~/RubymineProjects/Loccasions$ gem environment
The program 'gem' can be found in the following packages:
* ruby
* rubygems
Try: sudo apt-get install <selected package>
I have sifted through all of the settings that I'm aware of in RubyMine that relate to the SDK, and have directed them the ruby-2.1.3 stored in rbenv. I have done much research on this topic, but my attempts are futile. I would appreciate help in diagnosing this error.
I added $HOME/.rbenv/shims to my path through
export PATH="$HOME/.rbenv/shims:$PATH"
And it works!
Related
I think I've got a simple problem but I've spent hours searching for the answer. It's taken me a while to get the correct version of ruby installed and recognized when running ruby -v (it had previously been v2.5.1, but for some reason I still can't use the command bundle install. It tells me I've got the wrong version of ruby... but this doesn't appear to be true???
I am trying to deploy a Ruby on Rails repository to an EC2 instance.
Any help would be much appreciated! Thanks in advance.
I have ran these commands from within my repository directory:
ruby -v
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
bundle install
Your Ruby version is 2.5.1, but your Gemfile specified 2.5.3
.bashrc and .bash_profile have the following commands in them:
export PATH="$HOME/.rbenv/bin:~/.rbenv/shims:$PATH"
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
Available versions:
~/.rbenv/versions$ ls
2.5.3
irb
irb(main):001:0> RUBY_VERSION
=> "2.5.3"
rbenv version
2.5.3 (set by /home/ubuntu/.rbenv/version)
whereis ruby
ruby: /usr/bin/ruby
/usr/bin/ruby2.5
/usr/lib/x86_64-linux-gnu/ruby
/usr/lib/ruby
/home/ubuntu/.rbenv/shims/ruby
/snap/bin/ruby.rake /snap/bin/ruby.bundle
/snap/bin/ruby.gem
/snap/bin/ruby.env
/snap/bin/ruby.rdoc
/snap/bin/ruby
/snap/bin/ruby.irb
/snap/bin/ruby.ri
/usr/share/man/man1/ruby.1.gz
gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.7.6
- RUBY VERSION: 2.5.3 (2018-10-18 patchlevel 105) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/ubuntu/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0
- USER INSTALLATION DIRECTORY: /home/ubuntu/.gem/ruby/2.5.0
- RUBY EXECUTABLE: /home/ubuntu/.rbenv/versions/2.5.3/bin/ruby
- EXECUTABLE DIRECTORY: /home/ubuntu/.rbenv/versions/2.5.3/bin
- SPEC CACHE DIRECTORY: /home/ubuntu/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /home/ubuntu/.rbenv/versions/2.5.3/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/ubuntu/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0
- /home/ubuntu/.gem/ruby/2.5.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "“gem" => "--no-document”"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/ubuntu/.rbenv/versions/2.5.3/bin
- /home/ubuntu/.rbenv/libexec
- /home/ubuntu/.rbenv/plugins/ruby-build/bin
- /home/ubuntu/.rbenv/shims
- /home/ubuntu/.rbenv/bin
- ~/.rbenv/shims
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local
You can try to force an update to your Ruby version in the Gemfile.lock:
bundle update --ruby in the same folder as the Gemfile.
If that didn't work you could also try a:
gem install bundler
Making sure you're in a directory/project that is using ruby 2.5.3 (i.e double check with ruby -v).
Finally you can do a manual rbenv rehash to check it's up-to-date:
rbenv rehash
Can't create a rails project after installing rails.
Mac Mojave 10.14.6
$ ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin18]
$ which ruby
/usr/local/opt/ruby/bin/ruby
$ gem -v
3.1.2
$ sudo gem install rails
Successfully installed rails-6.0.2.2
Parsing documentation for rails-6.0.2.2
Done installing documentation for rails after 0 seconds
1 gem installed
Then tried to create a rails project
$ rails new blah
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
$ which rails
/usr/bin/rails
Any ideas why I can't create a rails project as rails seems to be installed?
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 3.1.2
- RUBY VERSION: 2.7.1 (2020-03-31 patchlevel 83) [x86_64-darwin18]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.7.0
- USER INSTALLATION DIRECTORY: /Users/shanegibney/.gem/ruby/2.7.0
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- GIT EXECUTABLE: /usr/local/bin/git
- EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/2.7.0/bin
- SPEC CACHE DIRECTORY: /Users/shanegibney/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.7.1/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-18
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.7.0
- /Users/shanegibney/.gem/ruby/2.7.0
- /usr/local/Cellar/ruby/2.7.1/lib/ruby/gems/2.7.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/opt/ruby/bin
- /usr/local/opt/ruby/bin
- /usr/local/opt/ruby/bin
- /opt/local/bin
- /opt/local/sbin
- /opt/local/bin
- /opt/local/sbin
- /usr/local/sbin
- /usr/local/mysql/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /Library/TeX/texbin
- /opt/X11/bin
- /Library/Frameworks/Mono.framework/Versions/Current/Commands
- /opt/ImageMagick/bin
- /Applications/Wireshark.app/Contents/MacOS
Then,
$ /usr/bin/rails new blah
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
-bash: tail: command not found
-bash: sed: command not found
Also tried,
$ export PATH="/usr/bin/rails" >> ~/.bash_profile
-bash: tail: command not found
-bash: sed: command not found
Thanks,
I do not have RVM installed. I want to install ruby 2.5.1. When I install RVM with "rvm install ruby-2.5.1", I get the error: "-bash: rvm: command not found".
My default ruby version in my iMac is 2.3.3
When I run "ruby -v" I'm getting this,
ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
But the latest version is 2.5.1
When I try to install rvm it's getting this message.
NOTE: GPG version 2.1.17 have a bug which cause failures during fetching keys from remote server. Please downgrade or upgrade to newer version (if available) or use the second method described above.
I tried these to solve my problem URL's to solve, but no use.
http://railsapps.github.io/installrubyonrails-mac.html
https://www.ruby-lang.org/en/downloads/
https://blog.arkency.com/which-ruby-version-am-i-using-how-to-check/
When I enter "gem env"
RubyGems Environment:
- RUBYGEMS VERSION: 2.5.2
- RUBY VERSION: 2.3.3 (2016-11-21 patchlevel 222) [universal.x86_64-darwin17]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/research/.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/research/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-17
- GEM PATHS:
- /Library/Ruby/Gems/2.3.0
- /Users/research/.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:
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
Finally i updated successfully with the help of these links...
https://www.computersnyou.com/5307/setup-homebrew-and-rvm-on-mac-osx-10-11-ei-capitan/
I typed this command,
\curl -sSL https://get.rvm.io | bash -s stable
After that i used this command,
type rvm | head -n 1
It's printing "rvm is a function"
After that i used this command,
rvm install ruby-head
After some time RVM installed.
When i type this command
ruby -v
I'm getting this message "ruby 2.6.0dev (2018-05-16 trunk 63444) [x86_64-darwin17]"
Running bundle install I get the error: "-bash: bundle: command not found"
I can install Bundler with gem install bundler and I get no errors. In fact, if I run gem list it shows bundler (1.14.6). However, bundle -v or anything like that doesn't work.
I have uninstalled bundler and re-installed.
gem env returns:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.5.1
- RUBY VERSION: 2.2.3 (2015-08-18 patchlevel 173) [x86_64-darwin15]
- INSTALLATION DIRECTORY: /usr/local/Cellar/ruby/2.2.3/lib/ruby/gems/2.2.0
- RUBY EXECUTABLE: /usr/local/Cellar/ruby/2.2.3/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/Cellar/ruby/2.2.3/bin
- SPEC CACHE DIRECTORY: /Users/mike/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.2.3/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-15
- GEM PATHS:
- /usr/local/Cellar/ruby/2.2.3/lib/ruby/gems/2.2.0
- /Users/mike/.gem/ruby/2.2.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/Cellar/ruby/2.2.3/bin/ruby
- /usr/local/bin/gem
brew doctor says "Your system is ready to brew"
echo $PATH says /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Cellar/ruby/2.2.3/bin/ruby:/usr/local/bin/gem
which gem returns: /usr/local/bin/gem
While this may not be a solution to your current issue, it is an alternative that could help you down the road in developing in Ruby / Rails.
I'd recommend moving to a ruby version control system such as RVM or rbenv where you then have full control over your ruby version on a per-project basis. It's much easier than playing with your system Ruby on OS X too. You'll probably find that once you have one of these installed, your bundler issues disappear.
Well, it's a little bit late answer, but I was able to do it like this:
gem install bundler -n /opt/homebrew/opt/ruby#2.5/bin
Where /opt/homebrew/opt/ruby#2.5/bin is a path where homebrew ruby installation gems is located
I install bundle by using
sudo bundle install and sudo gem install bundler
It show error
bundle: command not found
I set path like this.
export PATH=$PATH:/var/lib/gems/1.8/bin
When I run command gem environment it show like this.
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.8
- RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
- USER INSTALLATION DIRECTORY: /root/.gem/ruby/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /usr/bin
- SPEC CACHE DIRECTORY: /root/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/lib/ruby/gems/1.8
- /root/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-rdoc --no-ri"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
When I run command echo $PATH it show like this.
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
How to fix error bundle: command not found ?
Simply hit the command
$gem install bundle
if the ruby version is required to updated do it separately
bundle(r) is a gem. I am guessing you have the gem not installed yet.
try
gem install bundler
Well, you're trying to install ruby as system package, and I would suggest not doing that since ruby 1.8 is very old version.
You should use rvm or rbenv instead for ruby installation.
Take a look on http://rvm.io. After rvm installed, install ruby
rvm install 2.3.1
then install bundler
gem install bundler