When installing the Mysql gem and I have RVM installed, do I install with sudo gem install mysql or do I do it through the rvm some how??
many thanks.
You just want to switch into your RVM profile and then do a gem install mysql. Normally you don't want to use the sudo when install gems into an RVM profile.
type rvm list then you'll see which ruby version is active. running gem install will install the gem for that verison of ruby.
Related
bundler (2.0.1, default: 1.17.2)
How could I change the default to 2.0.1
Following https://bundler.io/guides/bundler_2_upgrade.html#upgrading-applications-from-bundler-1-to-bundler-2, here's what worked for me:
gem install --default bundler
gem update --system
bundle update --bundler
What helped me is to delete the current default manually from the folder
lib\ruby\gems\2.6.0\specifications\default\
and then install fresh bundler as usually
gem install bundler
or as default
gem install --default bundler
I had this same concern when trying to setup Bundler gem 2.2.11 as the default gem on my machine.
Here's how I achieved it:
First, I listed and uninstalled all other versions of the Bundler gem because I did not need them:
gem list bundler
gem uninstall bundler
If you encounter an error like this
Gem bundler-2.1.4 cannot be uninstalled because it is a default gem
Simply run the command below to get your ruby installation directory:
gem environment | grep "INSTALLATION DIRECTORY"
This should display an output like this. In my case my ruby version was 2.7.2:
- INSTALLATION DIRECTORY: /home/mycomputer/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0
Next, navigate to the specifications/default directory of the INSTALLATION PATH:
cd /home/mycomputer/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/specifications/default
Remove/delete the bundler.gemspec file that you have there. In my case it was bundler-2.1.4.gemspec, so I ran the command:
rm bundler-2.1.4.gemspec
Next, I installed the Bundler gem 2.2.11 and made it the default gem:
gem install --default bundler -v 2.2.11
Next, I listed my Bundler versions:
gem list bundler
Finally, I updated my gems to use the newly installed Bundler:
gem update --system
That's all.
I hope this helps
You need to remove .spec file to remove the gem.
Steps:
gem env – try to search in provided list under GEM PATHS, in specifications/default
remove there bundler-VERSION.gemspec
install bundler, if you don't have specific: gem install bundler:VERSION --default
gem install --default bundler:<version>
You need to know where the default specs are, so use gem environment to find out.
the steps I used were:
gem environment
# note INSTALLATION DIRECTORY
cd <installation_dir>
cd specifications/default
rm bundler-2.1.4.gemspec
gem install --default bundler -v 2.2.11
Remove all default bundler versions.
Commands:
$ gem environment
$ cd INSTALLATION DIRECTORY
$ cd specifications
$ cd default
$ rm bundler version
$ gem install bundler
I've tried the following commands:
rvm system gem install rails
rvm system install rails
rvmsudo gem install rails
sudo gem install rails
After one of these commands, I get a message telling me to run sudo gem install rails. But it doesn't work.
I had no problems before to install rails on rvm 1.9.2 the Mac OSX 10.6.8 version.
Could anyone help me with that?
If you've installed rvm successfully, test with rvm info so that it returns output then you just need to do gem install rails to install rails into the ruby version you are using with RVM - no sudo required. Have I misunderstood?
First check either rvm install properly or not using this command
rvm --help
then install rails by this command
gem install rails -v=3.2.1
Or any version you want..
If you don't have ruby 1.9.3 then use:
$ rvm install 1.9.3
or you may start from this:
$ rvm use 1.9.3
$ rvm gemset create rails313
$ rvm use 1.9.3#rails313 --default
$ gem install rails -v 3.1.3
note: I use 1.9.3 as an example you can use other ruby version also.
Follow the documentation. Make sure you've got the necessary system requirements via rvm requirements. Unless you've got some bizarre user permissions in $HOME, there is no reason to use sudo w/ rvm on your system.
make sure you have installed build_essentials, also try rvm requirements, which gives all dependencies, install all using rvmsudo command
See also: Installing Ruby on Rails - Mac OS Lion
First check whether all dependencies are satisfied by running:
$ rvm requirements
next:
$ rvm install ruby
next:
$ gem install rails
Note: You may have to use sudo or rvmsudo before the commands depending on whether its system-wide install or user specific.
How do I install the Heroku gem to my root directory? I tried sudo gem install heroku, but this doesn't seem to work. Any other suggestions? I am working with OSX.
I would not recommend installing gems in locations other than where RVM or gem wants to install the files, but you can override the install location like this:
sudo gem install heroku --install-dir /path/to/install/into
Where /path/to/install/into is where you want to install the gem.
I'm a bit of a Linux noob trying to get ruby, rails, mysql and sqlite all playing nicely on ubuntu 10. I am getting errors, and I realized that the versions are different for sudo versus normal user!
mpw#ubuntu:~/.rvm/gems/ruby-1.9.2-p0$ gem --version
1.3.7
mpw#ubuntu:~/.rvm/gems/ruby-1.9.2-p0$ sudo gem --version
1.3.5
I have used RVM to install it, but it seems that I have conflicting versions. How to fix?
I did the same installation mistake before, but following these instructions worked. http://ascarter.net/2010/05/10/rails-development-on-ubuntu-10.04.html
sudo gem --version most likely is using the system gem i.e the one you get when you do rvm system. This is because sudo changes user to root and you probably didn't do sudo rvm use 1.9.2 or something similar. Try doing sudo which gem and which gem to confirm this.
You can update the version used by root by doing sudo gem update --system. However note that you are still most likley using different gem paths when using sudo gem and gem if you are not using the system gem executable by default i.e rvm use system.
Please try a
sudo which gem
resp
which gem
to get the information which gem you are using.
I second the opinion of the answer above that most probably you are using different gem versions and paths.
I've been poking around the internet looking for a solution on this one... with no luck..
I'm new to rails... If anyone has an idea, I'd love to hear it. Much appreciated!
I enter:
LW:src liamwright$ sudo gem install rails --include-dependencies
And Get:
INFO: `gem install -y` is now default and will be removed
INFO: use --ignore-dependencies to install only the gems you list
Bulk updating Gem source index for: http://gems.rubyforge.org
ERROR: could not find rails locally or in a repository
I am running:
ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]
Mac OS X 10.5.8
I also tried:
gem sources -r gems.rubyonrails.org
And Get:
source gems.rubyonrails.org not present in cache
Just to check...
...try doing a sudo gem update --system before installing Rails to make sure you have the latest RubyGems installed?
EDIT: Actually, if your RubyGems install is really old, you might need to follow the alternate directions on Gemcutter.
Might want to make sure you have the newest rubygems:
sudo gem install rubygems-update
sudo gem update --system
Then:
sudo gem install rails
I came across this solution on Albertux' blox. Running this script will fix it (It worked perfectly for me on an Ubuntu 9.10 machine):
#!/bin/bash
#(download the latest on http://rubyforge.org/frs/?group_id=126)
wget http://rubyforge.org/frs/download.php/43984/rubygems-update-1.3.0.gem
sudo gem install rubygems-update-1.3.0.gem
sudo update_rubygems
# now this work:
sudo gem update --system
echo "done."
I've just had the same problem trying to upgrade rubygems from 1.2.0 to 1.3.7.
Setp-1)
So I just downloaded rubygems-update-1.3.7.gem from http://rubyforge.org/frs/?group_id=126
Setp-2)
gem install rubygems-update-1.3.7.gem
Setp-3)
update_rubygems
and it work for me.