When I try to run any ruby code, I get a pop up that Says "Launching differences2.rb' has encountered a problem. Unable to find a Ruby executable.
When I run 'gem environment' from inside Aptana I get this:
gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.6
- RUBY VERSION: 1.9.2 (2011-07-09 patchlevel 290) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/adamar/.rvm/gems/ruby-1.9.2-p290
- RUBY EXECUTABLE: /home/adamar/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
- EXECUTABLE DIRECTORY: /home/adamar/.rvm/gems/ruby-1.9.2-p290/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/adamar/.rvm/gems/ruby-1.9.2-p290
- /home/adamar/.rvm/gems/ruby-1.9.2-p290#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
When I run 'ruby -v' from inside Aptana I get this:
ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
When I run 'rvm use 1.9.2' from inside Aptana I get :
rvm use 1.9.2
Using /home/adamar/.rvm/gems/ruby-1.9.2-p290
I restarted and tried again after each of those commands, I also tried this:
rvm use 1.9.2 --default
Can anyone make a suggestion as to what I can do?
It's not clear from your question which version of Aptana you're using. If you're using Aptana Studio 3.x, then it should pick up your environment setup in .bashrc and your typical shell setup. We basically just search PATH for the location of the ruby executable. It'd be useful to see the output of "echo $PATH" inside the Terminal view in the IDE and outside the IDE to see if they differ. However it seems like it's already finding it when you run the "ruby -v" command in the shell, so I'm not really clear on what the issue might be.
You can try turning on debug level logging inside Preferences > Aptana Studio > Troubleshooting. You can up the log level to "All", and/or check "Debug specific components" and check the com.aptana.core/debug and com.aptana.core/debug/shell entries. That should hopefully spit out low level details on what process get run under the hood and the command lien args, executables and environment used. You can view the log by going to Help > Aptana > View Log File. We typically ask for the contents of this log when users file bugs at http://jira.appcelerator.org/secure/CreateIssue!default.jspa
I had the same problem and "solved" it by removing all references to Cygwin from my PATH. It must not be parsing it correctly when Cygwin goes in and changes your path.
I had the same problem working on Ubuntu with rvm, so I created a symbolic link, like sudo ln -s ~/progs/Aptana\ Studio\ 3/AptanaStudio3 /usr/local/bin/aptana and from a terminal execute aptana &
Try going to the folder where Aptana is installed and edit the file "studio3".
Add this in the begging
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session as a function
This will force it to load your rvm path when opening Aptana. You can then run open it by using ./studio3
I noticed that when running
Aptana terminal loads the .aptanarc instead of .bashrc on start up. You can adjust the path configurations for rbenv like this
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.aptanarc
echo 'eval "$(rbenv init -)"' >> ~/.aptanarc
I found this on another site and it helped my Apatana find the ruby executable. I would cite the author, but there is no name.
Related
Running gem install from shell script giving error even though I ruby version2.3.0 installed on my machine.
I am trying to install a gem from sh file. sh file code is as below:
cat > /tmp/install_bandshell.sh <<EOF
#!/bin/sh -e
cd /tmp
git clone git://github.com/concerto/bandshell.git
cd bandshell
gem build bandshell.gemspec
gem install *.gem
cd /
rm -rf /tmp/bandshell
EOF
chmod +x /tmp/install_bandshell.sh
/tmp/install_bandshell.sh
But when I run this sh file get error WARNING: You don't have /root/.gem/ruby/1.9.1/bin in your PATH, gem executables will not run. ERROR: Error installing bandshell-1.7.2.gem: rack requires Ruby version >= 2.2.2.
Even I install 2.3.0 gem env output
RubyGems Environment:
- RUBYGEMS VERSION: 2.5.1
- RUBY VERSION: 2.3.0 (2015-12-25 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.3.0/gems/
- USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/2.3.0/gems/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.3.0/gems/
- /root/.gem/ruby/2.3.0
- /usr/local/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/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/local/lib/ruby/gems/2.3.0/gems
From terminal, if I install this gem it works but from shell script giving above error. Please help me with this. Platform is Debian Wheezy.
I'm answering your primary question only, regarding the message. (Frankly, I don't know what's going on with your sh file, so I'm not going to address whatever other problems it causes.)
The message is a warning to you that any executables that the gem installs are not in your path. If the gem does not install any executables, then you can safely ignore the message. If it does (or you are simply unsure), then modify the path accordingly. How you do that depends on what shell you happen to be using. Since you have tagged the question with 'linux', I will guess that you are using bash; if so, add to either your ~/.profile or to ~/.bash_profile an entry similar to:
PATH="$PATH:/root/.gem/ruby/1.9.1/bin"
Now, at this point, I have to wonder - are you using ruby-1.9? You know that ruby 1.9 is obsolete, right? Actually, considering that you seem to be using Ruby 2.3.0, that's not likely. What I would suggest is to (at least temporarily) adjust your PATH as above to avoid the warning. I suspect you will still have problems, but then you can ask a new question without the WARNING that you have cited.
One last point, ignore suggestions that you should change your shebang to be other than "#!/bin/sh"; that's very unlikely to help.
Answering the WARNING: You don't have /root/.gem/ruby/1.9.1/bin in your PATH, gem executables will not run. problem...
Try add this line on your ~/.bashrc or ~/.zshrc:
export PATH="/root/.gem/ruby/1.9.1/bin:$PATH"
I'm trying to debug a Rails project within RubyMine v2018.2 (2018.2.1, 2018.2.4). When I start the editor I get a warning:
RubyMine Gem Manager: RubyMine has detected that some of the gems required for 'project' are not installed.
When I try to run RubyMine's Bundler install command I'm told
bash -c "RBENV_VERSION=2.5.0 /usr/bin/rbenv exec bundle install -V"
Activating bundler (< 2) failed:
Could not find 'bundler' (< 2) among 28 total gem(s)
Checked in 'GEM_PATH=/home/brad/.gem/ruby/2.5.0:/var/lib/gems/2.5.0:/usr/lib/x86_64-linux-gnu/rubygems-integration/2.5.0:/usr/share/rubygems-integration/2.5.0:/usr/share/rubygems-integration/all', execute `gem env` for more information
To install the version of bundler this project requires, run `gem install bundler -v '< 2'`
...and when I try to run or debug my application from the IDE I'm told "Could not find bundler (version) required by your project-path/Gemfile.lock."
Why doesn't RubyMine detect my installed Gems?
My environment
Ubuntu 18.04.01
zsh 5.4.2
rbenv 1.0.0
rbenv-binstubs # 8ecb7ca8
Rubymine 2018.2.4
I'm using rbenv to manage my Ruby versions. The system has Ruby 2.5.1 installed, but my project depends on 2.5.0. I've set 2.5.0 as the rbenv global version. Configuration for how rbenv chooses a Ruby version seems okay; I get the following results from the noninteractive commands:
> echo $RBENV_VERSION
(no response)
> cat ~/.rbenv/version
2.5.0
> rbenv global
2.5.0
After noticing rbenv wasn't working properly in some RubyMine commands I moved the eval "$(rbenv init -)" setup step from by ~/.zshrc up to ~/.zshenv and ~/.profile so it will also apply to bash and zsh login shells (per guidance here). I'm now getting matching results for interactive and login shells, but still getting unexpected behavior from the Bundle install command within RubyMine.
What is working
My application installs, builds and runs just fine from an interactive shell.
RubyMine's Ruby SDK settings correctly detect rvm and its installed versions, and all of the installed gems for that version.
What I've tried
The output from the bundle install command claims it's running
bash -c "RBENV_VERSION=2.5.0 /usr/bin/rbenv exec bundle install"
When I run this from my interactive shell or with RubyMine's "Run anything" feature (login shell) this command works fine - as does any of the following:
RBENV_VERSION=2.5.0 /usr/bin/rbenv exec bundle install
/usr/bin/rbenv exec bundle install
rbenv exec bundle install
bundle install
So I can't figure out what context RubyMine is using to run this command. It's clear from the error message that the GEM_PATH is incorrect, causing RubyMine to look in the wrong place for bundler, but I don't know where it's getting this configuration. If I bring up the "RubyGems Environment" view in RubyMine I get:
RUBYGEMS VERSION: 2.7.3
RUBY VERSION: 2.5.0 (2017-12-25 patchlevel 0) [x86_64-linux]
INSTALLATION DIRECTORY: /home/brad/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0
USER INSTALLATION DIRECTORY: /home/brad/.gem/ruby/2.5.0
RUBY EXECUTABLE: /home/brad/.rbenv/versions/2.5.0/bin/ruby
EXECUTABLE DIRECTORY: /home/brad/.rbenv/versions/2.5.0/bin
SPEC CACHE DIRECTORY: /home/brad/.gem/specs
SYSTEM CONFIGURATION DIRECTORY: /home/brad/.rbenv/versions/2.5.0/etc
RUBYGEMS PLATFORMS:
ruby
x86_64-linux
GEM PATHS:
/home/brad/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0
/home/brad/.gem/ruby/2.5.0
(...)
SHELL PATH:
/home/brad/.rbenv/versions/2.5.0/bin
/usr/lib/rbenv/libexec
/home/brad/.rbenv/plugins/ruby-build/bin
/home/brad/.rbenv/plugins/rbenv-gemset/bin
/home/brad/.rbenv/plugins/rbenv-binstubs/bin
(...rest of PATH...)
----------------------
IDE: RubyMine 2018.2.4, build #RM-182.4505.55
OS: Linux 4.15.0-38-generic[amd64]
Java: 1.8.0_152-release-1248-b8
RubyMine SDK Environment:
Sdk: rbenv: 2.5.0
Sdk Version: ver.2.5.0p0 ( revision 61468) p0
Ruby Interpreter: /home/brad/.rbenv/versions/2.5.0/bin/ruby
RVM Sdk: Rbenv sdk, gemset nullSdk Language Level: 2.5
Sdk Load Path:
~/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/did_you_mean-1.2.0/lib
~/.rbenv/versions/2.5.0/lib/ruby/site_ruby/2.5.0
~/.rbenv/versions/2.5.0/lib/ruby/site_ruby/2.5.0/x86_64-linux
~/.rbenv/versions/2.5.0/lib/ruby/site_ruby
~/.rbenv/versions/2.5.0/lib/ruby/vendor_ruby/2.5.0
~/.rbenv/versions/2.5.0/lib/ruby/vendor_ruby/2.5.0/x86_64-linux
~/.rbenv/versions/2.5.0/lib/ruby/vendor_ruby
~/.rbenv/versions/2.5.0/lib/ruby/2.5.0
~/.rbenv/versions/2.5.0/lib/ruby/2.5.0/x86_64-linux
~/.local/share/JetBrains/Toolbox/apps/RubyMine/ch-0/182.4505.55/rubystubs25
Sdk Gem paths:
~/.gem/ruby/2.5.0/gems
~/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/bundler/gems
~/.bundle/ruby/2.5.0/gems
~/.bundle/ruby/2.5.0/bundler/gems
~/.gem/ruby/2.5.0/bundler/gems
~/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems
(full list of gems used for project)
So I think that last bit - "Sdk Gem paths" - might be the problem point, but I don't see any way to configure it.
I'm also already aware of the YouTrack issue "Rubymine 2018.2 release does not take $GEM_HOME environment variable" and don't think it's quite what's happening here. It also claims to be fixed in 2018.3 EAP1, so I installed 2018.3 EAP7 but am still seeing this problem.
I got things working! By signing out and back in. :facepalm:
To be specific, I think the key steps were
Move the $(rbenv init -) step from my .zshrc up to my .zshenv and/or to .profile
Signing out and back in.
The key insight was noticing that ~/.rbenv/shims was missing from the RubyMine Gem Environment despite showing up in both interactive and login shells (in and out of RubyMine), and realizing that while new shells were picking up my .profile changes, RubyMine itself was probably inheriting its environment variables from my session and I'd need to log out/in to to pick up the changes.
I now see ~/.rbenv/shims in my RubyMine Gem Environment, and both the Bundler Install command and my run configurations are working again.
Thank you Casper for pointing me in the right direction!
Been where you are before a bunch of times.
Under the list of scripts you can run, click "Edit Configurations". Should be in the main toolbar.
Double check that you have "Run the script in context of bundle (bundle exec)" checked on the bundler tab. This is SUPER important and is not checked by default. Make sure you check for any rake, rails or irb configurations.
Keep in mind that the run configuration is where you can override the settings for the project. It will create all kinds of problems if this is not set appropriately.
Hope this helps! Bit me a bunch of times.
I have problem with my gem and Ruby command, I think it's because of path problem.
gem install jekyll
takes for a long time to run, and outputs an error message:
ERROR: Could not find a valid gem 'jekyll' (>= 0)
Unable to download data from https://rubygems.org/ - too many connection resets(https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz)
I entered which ruby, which output:
/usr/local/bin/ruby
If I enter which gem, it prints out:
gem () {
typeset result
(
typeset rvmrc
rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc")
if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]
then
rvm_rvmrc_files+=("${rvm_prefix}/.rvmrc")
fi
for rvmrc in "${rvm_rvmrc_files[#]}"
do
[[ -s "${rvmrc}" ]] && source "${rvmrc}" || true
done
unset rvm_rvmrc_files
command gem "$#"
) || result=$?
hash -r
return ${result:-0}
}
Enter whereis gem, prints out:
/usr/bin/gem
Does anyone know how to fix it? I've tried for a long time and get confused.
UPDATE:
Enter gem env I got:
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.3
- RUBY VERSION: 2.0.0 (2013-06-27 patchlevel 247) [x86_64-darwin13.0.0]
- INSTALLATION DIRECTORY: /Users/lijung/.rvm/gems/ruby-1.9.3-p374
- RUBY EXECUTABLE: /usr/local/Cellar/ruby/2.0.0-p247/bin/ruby
- EXECUTABLE DIRECTORY: /Users/lijung/.rvm/gems/ruby-1.9.3-p374/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-13
- GEM PATHS:
- /Users/lijung/.rvm/gems/ruby-1.9.3-p374
- /usr/local/bin/gem
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
enter rvm info:
ruby-1.9.3-p374:
system:
uname: "Darwin chi.local 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64"
system: "osx/10/x86_64"
bash: "/usr/local/bin/bash => GNU bash, version 4.2.37(2)-release (i386-apple-darwin12.2.0)"
zsh: "/bin/zsh => zsh 5.0.2 (x86_64-apple-darwin13.0)"
rvm:
version: "rvm 1.18.3 (master) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "9 months 18 days 11 hours 37 minutes 54 seconds ago"
ruby:
interpreter: "ruby"
version: "2.0.0p247"
date: "2013-06-27"
platform: "x86_64-darwin13.0.0"
patchlevel: "2013-06-27 revision 41674"
full_version: "ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin13.0.0]"
homes:
gem: "/Users/lijung/.rvm/gems/ruby-1.9.3-p374"
ruby: "/Users/lijung/.rvm/rubies/ruby-1.9.3-p374"
binaries:
ruby: "/usr/local/bin/ruby"
irb: "/usr/local/bin/irb"
gem: "/usr/local/bin/gem"
rake: "/usr/local/bin/rake"
environment:
PATH: "/usr/local/bin:/usr/local/sbin:/Users/lijung/.rvm/gems/ruby-1.9.3-p374/bin:/Users/lijung/.rvm/gems/ruby-1.9.3-p374#global/bin:/Users/lijung/.rvm/rubies/ruby-1.9.3-p374/bin:/Users/lijung/.rvm/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Postgres.app/Contents/MacOS/bin"
GEM_HOME: "/Users/lijung/.rvm/gems/ruby-1.9.3-p374"
GEM_PATH: "/usr/local/bin/gem"
MY_RUBY_HOME: "/Users/lijung/.rvm/rubies/ruby-1.9.3-p374"
IRBRC: "/Users/lijung/.rvm/rubies/ruby-1.9.3-p374/.irbrc"
RUBYOPT: ""
gemset: ""
The first thing I see that is a "really bad thing" when using RVM is:
PATH: "/usr/local/bin:/usr/local/sbin:/Users/lijung/.rvm/gems/ruby-1.9.3-p374/bin:/Users/lijung/.rvm/gems/ruby-1.9.3-p374#global/bin:/Users/lijung/.rvm/rubies/ruby-1.9.3-p374/bin:/Users/lijung/.rvm/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Postgres.app/Contents/MacOS/bin"
Even with how Stack Overflow formats this you can see that the RVM initialization isn't correct. RVM must be the first thing in your path. Look in your ~/.bash_profile or ~/.bashrc file and adjust the PATH manipulations so it comes first, then close the terminal window and reopen it. Checking the PATH should look something like:
"/Users/lijung/.rvm/gems/ruby-1.9.3-p374/bin:/Users/lijung/.rvm/gems/ruby-1.9.3-p374#global/bin:/Users/lijung/.rvm/rubies/ruby-1.9.3-p374/bin:/Users/lijung/.rvm/bin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Postgres.app/Contents/MacOS/bin"
The path is the chain of directories used by your shell when looking for a command. Your current path is telling the shell to find commands in /usr/local/bin and /usr/local/sbin first, which means it will find all Ruby-related commands in that directory first, which are NOT the ones that RVM installed for you.
Fixing the RVM initializer so it runs at the right point in your ~/.bash_profile or ~/.bashrc is the first step.
Your RVM is out of date too. Every couple weeks you should run rvm get stable to make sure you've got the latest settings and bug-fixes. Once your path is straightened out you can run that.
The error:
Unable to download data from https://rubygems.org/ - too many connection resets...
is indicative of internet problems between you and your server. Usually that will be fixed on its own. If it doesn't heal itself in a reasonable time, try restarting your machine, which will give the IP stack a chance to restart and flush all its caches; Though that code is well tested, there are still times it can lose it's mind and do dumb things. The reset is a poke in its eye which gets its attention. If THAT doesn't fix it consider calling your ISP.
I be able to use Ruby, that I've downloaded from brew? How can I set my gem path to the right path?
Deal with things in the right order. You can't use your Ruby as it's currently configured because your gems are not correctly associated with the right Ruby version and any changes you make to the Ruby installations will only result in confusion and mayhem. Once you have the path corrected and RVM running correctly, then it's a very simple RVM command to enable other Homebrew Rubies:
rvm use system --default
At that point, RVM will step out of the way and your other Rubies will be accessible via the PATH chain. You have to manage which Ruby version will be executed at that point.
Avoiding that hassle is why we use RVM or rbenv; They can easily install multiple Ruby versions and let you switch between them with a simple command, or even automatically when you chdir into a directory, if you set them up to do so. Brew only muddies the water, and trying to use a Brew installed Ruby was the source of your problem, so I'd recommend seriously rethinking that decision.
Finally, because you don't seem to understand what you're doing, and you're on Mac OS X, I'd recommend fixing this path problem, then backing away from the computer, READ ALL THE RVM PAGES until you REALLY understand what it does, then carefully make changes. Don't trust what other sites say about installing RVM, trust what the RVM authors say first. The authors know what works best for using it.
You might want to look into using JewelryBox also.
I recently upgraded to Ubuntu 9.04 and I have issues using gems.
I installed Ruby, Rubygems and Rails using apt-get.
The rails command does work.
I then installed capistrano and other gems, such as heroku.
In order to do that, I used the command:
sudo gem install XXX
When I want to use the cap command it does not work:
bash: cap: command not found
It is the same with the other gem commands.
Do I have something particular to do so that the gem commands work?
Where are my Gems?
You can find where your gems are stored using the gem environment command. For example:
chris#chris-laptop:~$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.2
- RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /usr/lib/ruby/gems/1.8
- /home/chris/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
If you look at the "GEM PATHS:" section you can see that gems can be stored in two places on my laptop: /usr/lib/ruby/gems/1.8 or in the .gem directory in my home dir.
You can also see that executables are stored in EXECUTABLE DIRECTORY which in this case is /usr/bin.
Because /usr/bin is in my path this lets me run cap, merb, rails etc.
Updating your PATH
If for some reason your EXECUTABLE DIRECTORY isn't on your path (for example if it is /var/lib/gems/1.8/bin) then you need to update your PATH variable.
Assuming that you are using the bash shell. You can do this quickly for the current session by typing the following at the shell prompt; let's pretend that you want to add /var/lib/gems/1.8/bin to the path:
export PATH=$PATH:/var/lib/gems/1.8/bin
and press return. That appends the new directory to the end of the current path. Note the colon between $PATH and /var/lib/gems/1.8/bin
To set the value for all sessions you will need to edit either your .profile or .bashrc file and add the same line to the end of the file. I usually edit my .bashrc file for no reason other than that's what I've always done. When finished, save the file and then refresh your environment by typing:
bash
at the shell prompt. That will cause the .bashrc to get reread.
At any point you can check the current value of $PATH by typing
echo $PATH
at the shell prompt.
Here's a sample from one of my own servers, where my username is "chris" and the machine name is "chris-laptop":
chris#chris-laptop:~$
chris#chris-laptop:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
chris#chris-laptop:~$
chris#chris-laptop:~$ export PATH=$PATH:/var/lib/gems/1.8/bin
chris#chris-laptop:~$
chris#chris-laptop:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/var/lib/gems/1.8/bin
chris#chris-laptop:~$
My Gem won't load!
"Ruby gems won't load even though installed" highlights a common problem using multiple different versions of Ruby; Sometimes the Gem environment and Gem path get out of sync:
rb(main):003:0> Gem.path
=> ["/opt/ruby1.9/lib/ruby1.9/gems/1.9.1"]
irb(main):004:0> exit
Any Ruby process here is looking only in one place for its Gems.
:~/$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.9.1 (2009-05-12 patchlevel 129) [x86_64-linux]
- INSTALLATION DIRECTORY: /opt/ruby1.9/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /opt/ruby1.9/bin/ruby1.9
- EXECUTABLE DIRECTORY: /opt/ruby1.9/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /opt/ruby1.9/lib/ruby/gems/1.9.1
- /home/mark/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
Look carefully at the output of gem environment:
- GEM PATHS:
- /opt/ruby1.9/lib/ruby/gems/1.9.1
This isn't the same path as returned by Gem.path:
["/opt/ruby1.9/lib/ruby1.9/gems/1.9.1"]
It's hard to say what exactly caused lib/ruby to change to lib/ruby1.9 but most likely the developer was working with multiple Ruby versions. A quick mv or ln will solve the problem.
If you do need to work with multiple Ruby versions then you really should be using rvm.
As noted by #Chris you need to add the gems environment to your path. You can do this by:
echo 'export PATH=$PATH:/var/lib/gems/1.8/bin' | tee --append ~/.bashrc
The folder in which gems are stored must be on your PATH, for example mine is:
/home/victor/.gem/ruby/1.8/bin
Check your path by typing
echo $PATH
It seens that when installing rubygems, now in ubuntu 9.04, I have this problem. I noticed that in "gem environment" the executable directory is "/var/lib/gems/1.8/bin", instead of "/usr/bin"... This is a problem with rubygems or with ubuntu 9.04??
The solution that I encountered is to add "/var/lib/gems/1.8/bin" to my $PATH doing this:
export PATH=$PATH:/var/lib/gems/1.8/bin
But it don't is saved... how can I save my path?
Thanks...
Resolvi: coloquei o export PATH=$PATH:/var/lib/gems/1.8/bin no ~/.bashrc! =]
mkmf is part of the ruby1.9.1-dev package. This package contains the header files needed for extension libraries for Ruby 1.9.1. You need to install the ruby1.9.1-dev package by doing:
sudo apt-get install ruby1.9.1-dev
I have installed RVM and as noted in the install http://rvm.beginrescueend.com/rvm/install/ I was able to get "rvm is a function."
A lot of what I've read recommends not to use sudo gem install bundler, but it did not work without sudo (the error said I was not able to write to var/lib/gems/1.8 with gem install bundler)
Even after "Successfully Installed bundler" I still get "Bundle command not found" when i try to run either "gem bundle install" or "bundle install" from my App.
I think I need to change the executable but I am lost as to how to do this.
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2010-06-23 patchlevel 299) [x86_64-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /var/lib/gems/1.8
- /home/james/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
Really appreciate any help. Thank you.
Ah, I cant remember exactly how I did this. It had to do with installing to the wrong directory. Adding the path on the ~/.bashrc file fixed it I am pretty sure. Try adding the lines below to the bottom of your ~/.bashrc file and see if that works. These are the three bottom lines of my file.
export RUBYOPT="-r rubygems"
export PATH=/var/lib/gems/1.8/bin:$PATH
if [[ -s /home/james/.rvm/scripts/rvm ]] ; then source /home/james/.rvm/scripts/rvm ; fi
The instructions that I used to figure this out are here also it looks like this might be a better way to do it, as it is a system wide installation. I would have done this if I did it over.
Also check these other posts regarding the same issue. I am sure you will be able to figure it out from there.
Good Luck!
post 1
post 2