I have scoured the internet for answers. I feel I have not followed the right way to do things and just want to set up my rvm environment in the proper way. This all stemmed from me having to use sudo gem install sass
to install SASS which I didn't want to do.
Now when I do gem install sass
I get:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
Steps I took:
sudo chown -R dhruv: /Library/Ruby/Gems/2.0.0
\curl -sSL https://get.rvm.io | bash -s stable --ruby
brew install gnupg gnupg2
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
sudo chown -R dhruv:staff ~/.rvm
sudo chown -R dhruv:staff ~/.gem
sudo chown -R dhruv:staff /Library/Ruby/Gems/2.0.0
Note that which rvm
doesn't return anything, even though running the curl command above gave me:
Upgrading the RVM installation in /Users/dhruv/.rvm/
RVM PATH line found in /Users/dhruv/.mkshrc /Users/dhruv/.profile /Users/dhruv/.bashrc /Users/dhruv/.zshrc.
RVM sourcing line found in /Users/dhruv/.profile /Users/dhruv/.bash_profile /Users/dhruv/.zlogin.
Upgrade of RVM in /Users/dhruv/.rvm/ is complete.
# dhruvghulati,
#
# Thank you for using RVM!
# We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.
I want to get things to a state where I can install gems easily without sudo. How do I do this?
Also, how do I prevent these PATH errors I am seeing for rvm
?
Also I am worried about when I did sudo chown -R dhruv:staff /Library/Ruby/Gems/2.0.0
, the internet seems to say this is a terrible evil and I will have to revert back? Can I revert this to maybe chmod
to the original user this should be owned by?
Here is the output of rvm info
:
Warning! PATH is not properly set up, '/Users/dhruv/.rvm/gems/ruby-2.2.1/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.2.1'.
ruby-2.2.1:
system:
uname: "Darwin Dhruvs-MacBook-Pro-2.local 14.5.0 Darwin Kernel Version 14.5.0: Tue Sep 1 21:23:09 PDT 2015; root:xnu-2782.50.1~1/RELEASE_X86_64 x86_64"
system: "osx/10.10/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)"
zsh: "/bin/zsh => zsh 5.0.5 (x86_64-apple-darwin14.0)"
rvm:
version: "rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "1 day 8 minutes 30 seconds ago"
path: "/Users/dhruv/.rvm"
ruby:
interpreter: "ruby"
version: "2.2.1p85"
date: "2015-02-26"
platform: "x86_64-darwin14"
patchlevel: "2015-02-26 revision 49769"
full_version: "ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]"
homes:
gem: "/Users/dhruv/.rvm/gems/ruby-2.2.1"
ruby: "/Users/dhruv/.rvm/rubies/ruby-2.2.1"
binaries:
ruby: "/Users/dhruv/.rvm/rubies/ruby-2.2.1/bin/ruby"
irb: "/Users/dhruv/.rvm/rubies/ruby-2.2.1/bin/irb"
gem: "/Users/dhruv/.rvm/rubies/ruby-2.2.1/bin/gem"
rake: "/Users/dhruv/.rvm/rubies/ruby-2.2.1/bin/rake"
environment:
PATH: "/Users/dhruv/anaconda/bin:/Users/dhruv/anaconda/bin:/Users/dhruv/.rvm/gems/ruby-2.2.1/bin:/Users/dhruv/.rvm/gems/ruby-2.2.1@global/bin:/Users/dhruv/.rvm/rubies/ruby-2.2.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Users/dhruv/.gem/ruby/2.0.0/bin:/Users/dhruv/scripts:/Users/dhruv/.rvm/bin:/Users/dhruv/.rvm/bin:/usr/local/lib:/Users/dhruv/.gem/ruby/2.0.0/bin:/Users/dhruv/scripts:/Users/dhruv/.rvm/bin:/Users/dhruv/.rvm/bin:/usr/local/lib"
GEM_HOME: "/Users/dhruv/.rvm/gems/ruby-2.2.1"
GEM_PATH: "/Users/dhruv/.rvm/gems/ruby-2.2.1:/Users/dhruv/.rvm/gems/ruby-2.2.1@global"
MY_RUBY_HOME: "/Users/dhruv/.rvm/rubies/ruby-2.2.1"
IRBRC: "/Users/dhruv/.rvm/rubies/ruby-2.2.1/.irbrc"
RUBYOPT: ""
gemset: ""
The command gem install --user-install sass
gives me:
WARNING: You don't have /Users/dhruv/.gem/ruby/2.2.0/bin in your PATH,
gem executables will not run.
Successfully installed sass-3.4.21
Parsing documentation for sass-3.4.21
Done installing documentation for sass after 4 seconds
1 gem installed
.bash_profile:
export PATH=$PATH:~/.gem/ruby/2.0.0/bin
export SBT_OPTS="-Xmx2G -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=2G -Xss2M -Duser.timezone=GMT"
export PATH=$PATH:~/scripts
source ~/.profile
source ~/.bashrc
export PATH=$PATH:/usr/local/lib
# added by Anaconda3 2.3.0 installer
export PATH="/Users/dhruv/anaconda/bin:$PATH"
export MONGO_PATH=/usr/local
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
.bashrc:
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
.profile:
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*