New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating user installed gems on macOS #2273

Closed
dsoreilly opened this Issue Apr 28, 2018 · 9 comments

Comments

Projects
None yet
5 participants
@dsoreilly

dsoreilly commented Apr 28, 2018

I'm having a problem or would like to suggest a feature.

I've been installing additional Ruby Gems on macOS (10.13.2) using the gem install GEMNAME --user-install command. In order to use them, I've created a .bash_profile and added the following line to it:

export PATH=$PATH:~/.gem/ruby/2.3.0/bin

The issue arises when I then try to update these Gems. I can update them all individually by specifying the name, but running gem update causes a file permission error due to the command trying to also update the system Gems.

Likewise, when I use the command gem update --user-install, this tries to install the latest versions all of the local Gems into the user directory, which seems like bad practice.

Essentially, I'm looking for a way to run gem update and only target the Gems currently in the /Users/USERNAME/.gem/ruby/2.3.0 directory.

This issue is related to:

  • Network problems
  • Installing a library
  • Publishing a library
  • The command line gem
  • Other

Here are my current environment details:

Ruby 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/USERNAME/.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/USERNAME/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-17
  - GEM PATHS:
    - /Library/Ruby/Gems/2.3.0
    - /Users/USERNAME/.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
    - /Users/USERNAME/.gem/ruby/2.3.0/bin

I will abide by the code of conduct.

@duckinator

This comment has been minimized.

Show comment
Hide comment
@duckinator

duckinator May 9, 2018

Member

hi!

Could you try adding the following to ~/.gemrc, and letting me know if it works?:

gem: --user-install

(If you already have a ~/.gemrc, just add --user-install to the end of the gem: line.)

Member

duckinator commented May 9, 2018

hi!

Could you try adding the following to ~/.gemrc, and letting me know if it works?:

gem: --user-install

(If you already have a ~/.gemrc, just add --user-install to the end of the gem: line.)

@bronzdoc

This comment has been minimized.

Show comment
Hide comment
@bronzdoc

bronzdoc May 30, 2018

Member

@dsoreilly can you provide feedback with what @duckinator suggetsed? thanks

Member

bronzdoc commented May 30, 2018

@dsoreilly can you provide feedback with what @duckinator suggetsed? thanks

@dsoreilly

This comment has been minimized.

Show comment
Hide comment
@dsoreilly

dsoreilly May 31, 2018

Apologies for the delay in trying this. I've just created a .gemrc file in my home directory and added the gem: --user-install line, unfortunaltey this hasn't produced the desired effect—all the system gems still get installed into the ~/.gem/ruby/2.3.0/gems directory.

dsoreilly commented May 31, 2018

Apologies for the delay in trying this. I've just created a .gemrc file in my home directory and added the gem: --user-install line, unfortunaltey this hasn't produced the desired effect—all the system gems still get installed into the ~/.gem/ruby/2.3.0/gems directory.

@ecnelises

This comment has been minimized.

Show comment
Hide comment
@ecnelises

ecnelises Jun 11, 2018

I don't have the problem on macOS 10.13.5 with both Ruby 2.3.5 and 2.4.2. (RubyGems version 2.6.10) Maybe you can update RubyGems version?

ecnelises commented Jun 11, 2018

I don't have the problem on macOS 10.13.5 with both Ruby 2.3.5 and 2.4.2. (RubyGems version 2.6.10) Maybe you can update RubyGems version?

@bronzdoc

This comment has been minimized.

Show comment
Hide comment
@bronzdoc

bronzdoc Jun 18, 2018

Member
gem: --user-install

isn't working for me neither 🤔

Member

bronzdoc commented Jun 18, 2018

gem: --user-install

isn't working for me neither 🤔

@MSP-Greg

This comment has been minimized.

Show comment
Hide comment
@MSP-Greg

MSP-Greg Jun 18, 2018

Contributor

Having used -user-install quite a bit (on Windows), there are certainly quirks.

Maybe add additional options like:

gem update --only-gem-dir    => only gems installed in Gem.dir or --no-user-install
gem update --only-user-dir   => only gems installed with --user-install
gem update --only-default    => only default (std-lib) gems

I believe this would cover all gems, question as to what a simple gem update would do...

Greg

Contributor

MSP-Greg commented Jun 18, 2018

Having used -user-install quite a bit (on Windows), there are certainly quirks.

Maybe add additional options like:

gem update --only-gem-dir    => only gems installed in Gem.dir or --no-user-install
gem update --only-user-dir   => only gems installed with --user-install
gem update --only-default    => only default (std-lib) gems

I believe this would cover all gems, question as to what a simple gem update would do...

Greg

@MSP-Greg

This comment has been minimized.

Show comment
Hide comment
@MSP-Greg

MSP-Greg Jun 29, 2018

Contributor

@dsoreilly

I believe something like the following is what I have in my .gemrc file (add other options as desired):

install: "--user-install"
update: "--user-install"

Greg

Contributor

MSP-Greg commented Jun 29, 2018

@dsoreilly

I believe something like the following is what I have in my .gemrc file (add other options as desired):

install: "--user-install"
update: "--user-install"

Greg

@bronzdoc

This comment has been minimized.

Show comment
Hide comment
@bronzdoc

bronzdoc Sep 12, 2018

Member

@dsoreilly is this still an issue for you? could you try with:

:gem: --user-install
Member

bronzdoc commented Sep 12, 2018

@dsoreilly is this still an issue for you? could you try with:

:gem: --user-install
@bronzdoc

This comment has been minimized.

Show comment
Hide comment
@bronzdoc

bronzdoc Sep 24, 2018

Member

closing due lack of response

Member

bronzdoc commented Sep 24, 2018

closing due lack of response

@bronzdoc bronzdoc closed this Sep 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment