Hello World

Be Happy!

when not changed rbenv local


Install

% rbenv install 3.0.0
Downloading openssl-1.1.1i.tar.gz...

But ruby -v showed 2.6.3

% rbenv local 3.0.0
% rbenv local      
3.0.0
% ruby -v           
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]

Failed gem install

% gem install bundler
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

Solution

% env | grep PATH                     
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin

# add below code to ~/.bash_profile
# add below code to .zprofile (mac os use zsh with .zprofile instead of bash with .bash_profile)
# https://github.com/rbenv/rbenv
vim ~/.zprofile
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init - zsh)"

# https://github.com/rbenv/rbenv/issues/1267
export GEM_HOME="$HOME/.gem"

% env | grep PATH                     
PATH=/Users/xxxx/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
 ~/project/grpc-hello-world  gem install grpc                                                                                                                       ✔  3.0.4   23:09:19 
Invalid gemspec in [/Users/xxxx/.gem/specifications/i18n-1.10.0.gemspec]: /Users/xxxx/.gem/specifications/i18n-1.10.0.gemspec:33: syntax error, unexpected ')', expecting '.' or &. or :: or '['
ze, ["~> 1.0"])
              ^
/Users/xxxx/.gem/specifications/i18n-1.10.0.gemspec:37: syntax error, unexpected `end', expecting end-of-input
  end
  ^~~
Invalid gemspec in [/Users/xxxx/.gem/specifications/tzinfo-2.0.4.gemspec]: /Users/xxxx/.gem/specifications/tzinfo-2.0.4.gemspec:37: syntax error, unexpected ')', expecting '.' or &. or :: or '['
ze, ["~> 1.0"])
              ^
/Users/xxxx/.gem/specifications/tzinfo-2.0.4.gemspec:41: syntax error, unexpected `end', expecting end-of-input
  end
  ^~~
Building native extensions. This could take a while...
^C#<Thread:0x00000001563c7ee8 /Users/xxxx/.rbenv/versions/3.0.4/lib/ruby/3.0.0/open3.rb:403 run> terminated with exception (report_on_exception is true):
/Users/xxxx/.rbenv/versions/3.0.4/lib/ruby/3.0.0/open3.rb:403:in `read': stream closed in another thread (IOError)
    from /Users/xxxx/.rbenv/versions/3.0.4/lib/ruby/3.0.0/open3.rb:403:in `block (2 levels) in capture2e'
ERROR:  Interrupted


 ~/project/grpc-hello-world  rm /Users/xxxx/.gem/specifications/tzinfo-2.0.5.gemspec
 ~/project/grpc-hello-worldgem update --system

Latest version already installed. Done.
 ~/project/grpc-hello-worldgem install grpc
Building native extensions. This could take a while...
Successfully installed grpc-1.50.0
Parsing documentation for grpc-1.50.0
Installing ri documentation for grpc-1.50.0
Done installing documentation for grpc after 4 seconds
1 gem installed
#ruby (13) #rbenv (1) #rehash (1)
List