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.
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 git cloned a repo. I cannot run it on localhost with rails server because terminal says
Could not find activesupport-4.2.5 in any of the sources Run bundle
install to install missing gems.
When I run bundle install, I get
An error occurred while installing pg (0.18.4), and Bundler cannot
continue. Make sure that gem install pg -v '0.18.4' succeeds before
bundling.
I have rails 4.2.3, and the repo's Gemfile has gem 'rails', '4.2.5'. I don't know if this matter
Gem pg is Postgres driver, it only can be installed, if corresponding headers and libraries are present and can be accessed.
Most probably just installing postgres will fix it. If you're on a Mac with homebrew - brew install postgresql
Install postgresql.
Remove Gemfile.lock
Add gem 'pg' in your gemfile
execute bundle install
1: Remove Gemfile.lock if Gemgile.lock present in your project
2: add gem 'pg' # in Gemfile
3: Run bundle install
Hope this help you !!!
Run
sudo env ARCHFLAGS="-arch x86_64" gem install pg -v '1.18.4'
Now try running bundle install again.
I used a combination of #Chakreshwar Sharma and #Vinay's answers to get this working for the metasploit-framework.
Remove Gemfile.lock
Add gem 'pg' in your gemfile
Run apt-cache search postgresql-server-dev
apt-get update && apt-get install postgresql-server-dev-9.5 # Check your version
bundle install --no-deployment
To be honest, I think you could just run:
apt-cache search postgresql-server-dev
apt-cache search postgresql-server-dev-9.5
bundle install
...and you can avoid messing with the Gemfile, but I didn't get to verify it since mine started working after I made the adjustments.
I got this error
Could not find mysql2-0.3.13 in any of the sources
Run `bundle install` to install missing gems.
I tried to gem install mysql2 but without luck, it didn't fix it. I'm using wampp server and copied the libmysql.ddl to the bin folder of ruby. I also tried adding the path to the gem install just like this.
gem install mysql2 --platform=ruby -- ‘-with-mysql-lib=”C:\wamp\bin\mysql\mysql5.5.24\lib” -with-mysql-include=”C:\wamp\bin\mysql\mysql5.5.24\include”‘
Any ideas on how to fix this? THanks!
First, make sure you have mysql installed on your machine.
If you have an Ubuntu distribution, try:
sudo apt-get install libmysql-ruby libmysqlclient-dev
then try to install the gem again.
I installed mysql2 from sources like this
# i experienced some troubles with mysql2 0.3.13 installing
gem fetch mysql2 -v 0.3.12
gem install mysql2-0.3.12.gem -- ' --with-mysql-include="c:\Program Files (x86)\MariaDB 5.5\include\mysql" --with-mysql-lib="c:\Program Files (x86)\MariaDB 5.5\lib" '
But after each Gemfile updating and bundle install, bundler is installing precompiled version of mysql2 gem and it's very annoying. After manual removing precompiled gem rails app started successfully
P.S. You also need installed Ruby DevKit.
I have tried everything from source installations, homebrew, and manually restoring the pg_config file as sudo user. I am out of ideas on this... here is what I get:
gem install pg -v '0.12.1'
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/pg-0.12.1/.gemtest
any help would be appreciated :).
Probably you ran sudo gem install pg to install pg, so the installed gem still has root permission. Run sudo chown -R Toran1 /Users/Toran1/.rvm to fix up the permission first. Then you should be able to run gem install pg
Manual gem installations like this can be installed with sudo.
sudo gem install pg -v '0.12.1'
Hope this helps!
EDIT:
As per the comments below, I noticed you are using rvm. Don't use sudo when using rvm. Check the paths and make sure that you do indeed have the correct permissions set!
use this:
RVMSUDO gem install pg
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.