Upgrading Ruby using homebrew on a mac and installing berkshelp - ruby

I just finished upgrading my ruby to fit the requirements for berkshelf... at least so i thought... and now when i try to implement berkshelf i throw this error:
ruby-build: use openssl from homebrew
Downloading ruby-2.3.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.bz2
Installing ruby-2.3.1...
Installed ruby-2.3.1 to /Users/meee/.rbenv/versions/2.3.1
meee$ sudo gem install berkshelf
Password:
ERROR: Error installing berkshelf:
buff-extensions requires Ruby version >= 2.2.0.
Has anyone encountered this problem before?
I'm running the newest sierra os build.

You are installing ruby for user meee, but berkshelf for root. It won't work. You should use user ruby all the time.
Maybe use ChefDK, it has berkshelf included and probably all other tools you might need for chef.

Related

Can't install Ruby Compass on Mac Big Sur 11.5.2

I'm trying to get Compass installed on a 2020 Mac Book Pro running Big Sur (11.5.2).
When I try and run:
gem install compass
I get the error:
You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory
If I try and run:
sudo gem install compass
I get the error:
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/ext/ffi_c
I've tried installing and updating Ruby.
I've tried updating the system Ruby, but the system doesn't allow a more recent version than the below:
Updating rubygems-update
Fetching rubygems-update-3.3.3.gem
Successfully installed rubygems-update-3.3.3
Parsing documentation for rubygems-update-3.3.3
Installing ri documentation for rubygems-update-3.3.3
Installing darkfish documentation for rubygems-update-3.3.3
Done installing documentation for rubygems-update after 206 seconds
Parsing documentation for rubygems-update-3.3.3
Done installing documentation for rubygems-update after 0 seconds
Installing RubyGems 3.3.3
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted # rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/gem
% ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
Not sure what to do or try next.
Anyone have any ideas on how to get Compass installed?
This really decomposes to two issues, as you noticed with the sudo call.
(1) You're trying to write gems to the protected directory for your system Ruby.
In most development environments, it's best to install a Ruby version manager that allows you to install multiple Rubies side-by-side for different projects. Purely subjectively, I'd recommend rbenv to manage only Ruby, or asdf to manage Ruby versions along with other languages versions. However, the question of which Ruby version manager to use is very well tread already, so you can pick the solution that's best for your needs with existing information.
(2) You're installing a gem with native extensions, which means that you need the underlying C libraries installed on your system to build correctly (assuming you're using CRuby, the default Ruby implementation). You'll need to install libffi-dev on your machine to build that gem correctly. Based on this question, it seems a simple brew install libffi should work for that.
Lastly, I'll suggest that it's idiomatic to use the bundler gem to manage gems per-project with Ruby. I'd reconsider if you really want to run this gem system-wide, or if it might vary versions across multiple projects.

Ruby installation (2.1.2) fails in macOS Big Sur(11.2.3)

I am not able to install ruby 2.1.2 on MacBook Pro (16-inch, 2019). I am getting below issue
Downloading ruby-2.1.2.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.bz2
Installing ruby-2.1.2...
WARNING: ruby-2.1.2 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
ruby-build: using readline from homebrew
BUILD FAILED (macOS 11.2.3 using ruby-build 20210309)
Inspect or clean up the working tree at /var/folders/m8/2rpyp98n6kn0f5628315l8jr0000gn/T/ruby-build.20210319190843.1296.BVeODj
Results logged to /var/folders/m8/2rpyp98n6kn0f5628315l8jr0000gn/T/ruby-build.20210319190843.1296.log
Last 10 log lines:
installing capi-docs: /Users/shodhangk/.rbenv/versions/2.1.2/share/doc/ruby
The Ruby openssl extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
--prefix=/Users/shodhangk/.rbenv/versions/2.1.2
--with-openssl-dir=/usr/local/opt/openssl#1.1
--with-readline-dir=/usr/local/opt/readline
CC=clang
LDFLAGS=-L/Users/shodhangk/.rbenv/versions/2.1.2/lib
CPPFLAGS=-I/Users/shodhangk/.rbenv/versions/2.1.2/include
I looked at this Ruby installation (2.2.2) fails in macOS Big Sur and tried with all below solutions but still, the same issue exists.
RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl#1.0/1.0.2t rbenv install 2.1.2
CFLAGS="-Wno-error=implicit-function-declaration" rbenv install 2.1.2
Even tried by slightly changing the ruby versions to 2.1.x and 2.2.x. But no difference.

Using chef-metal with Windows-7

I want to use chef-metal with on my windows workstation. Following are details of my setup :
OS : Windows 7, 32-bit
Chef client version : 11.12.0
I follow the instructions as mentioned here . I intend to use the Vagrant driver for chef-metal, so I have vagrant and virtualbox installed on my system. Next as the documentation says, I install 'chef-metal' gem, and then try to run the basic vagrant_linux and simple recipes. But the setup is giving me rubygems conflicts for gem 'ffi', the error is shown in the screenshot below :
Apparently, installing chef-metal gem is messing up my chef-client installation also. If I run chef-client -v, just to check if chef-client is working fine, i throws the same gem conflict error.
While installation of chef-metal gem, I observe that it is installing certain gems, that are already installed on the system(with the chef-client installation.) I tried to uninstalling a version of the gem throwing the error(ffi-1.9.3-x86-mingw32), but it showed me this info:
Same is the response i get when i try to uninstall ffi-1.5.0-x86-mingw32 gem.
Update :
As per Tensibai's suggestions, I removed teh older version of the gem and updated to use a new one. Following is the new gem dependency error I get :
Please help as I have reached a dead end on searching a solution for this one:
Gem documentation is HERE
To uninstall it is gem uninstall ffi -v 1.5.0
What the errors tells you is that it can't load it because ffi is in versino 1.5 and ohai require it in a version around 1.9.X (the ~> 1.9).
You best bet to resolve the problem is to run a gem update ffi -v 1.9.3
And update chef too to remove old depending: gem update chef

Errors Installing vagrant.berkshelf

I working on a Windows 7 machine with Vagrant v 1.4.1 and I have been struggling to install the vagrant-berkshelf plugin. I'm following some instructions from a blog by Mischa Taylor. I've installed VirtualBox (4.2.20), a "sane" Ruby environment (with the DevKit) and the berkshelf gem and that went fine as well but whenever I issue the
> vagrant plugin install vagrant-berkshelf
The command returns an error when trying to build the
Installing the 'vagrant-berkshelf' plugin. This can take a few minutes...
C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/rubygems/ext/builder.rb:62:in `run':
ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
C:/HashiCorp/Vagrant/embedded/bin/ruby.exe extconf.rb
C:/HashiCorp/Vagrant/embedded/bin/ruby.exe: invalid option -J (-h will show valid
options) (RuntimeError)
Gem files will remain installed in C:/Users/user_me/.vagrant.d/gems/gems/hitimes-
1.2.1 for inspection.
Results logged to C:/Users/user_me/.vagrant.d/gems/gems/hitimes-1.2.1/ext/hitimes/c/gem_make.out
from
C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/rubygems/ext/ext_conf_builder.rb:39:in `block in build'
if I issue
> gem install hitimes
that works fine, so the problem seems to be in the extension builder that Vagrant uses. I don't have alot of experience working with Ruby I was just wanting to start learning to use chef and berkshelf with vagrant.
This may be due to the version of Ruby
try rvm to manage your ruby environments, download ruby 1.9.3 through rvm
then
rvm use 1.9.3
vagrant plugin install vagrant-berkshelf

gem install capistrano failure

I tried to install the package "capistrano" on a linux box but got the following error:
*** buffer overflow detected ***: /usr/bin/ruby terminated
Additionally it showed me a list of the memory map and then the install process was aborted.
Any idea on what causes this error?
Cheers
Roland
I had similar issue when installing Capistrano on CentOs 6.7, Ruby 1.8.5, gem 1.3.1. Turns out the issue was caused by newest highline package.
The following allowed me to install capistrano correctly:
gem install highline --version "=1.6.2"
gem install capistrano --version "=2.6.0"
This error may be related to some Ruby 1.8.6 bugs (see this post http://opsrealism.tumblr.com/post/4931621276/mirroring-rubygems-and-ruby-9-2-on-centos-5-5 for some more details), so you may try to upgrade your Ruby to 1.8.7, if it's possible.
Another option is to try to install a bit older version of gem - it worked for me on a couple of occasions, where exact gem versions didn't matter. For example,
gem install capistrano --version "=2.7.0"
might work.
I'm running:
Centos 5.5
Ruby 1.8.5
Gems 1.3.1
I narrowed the problem down to the highline gem. Although I attempted to intall all of its dependencies manually (which worked), it still failed to load itself unless I followed the above advice and specified the version, 1.6.2. =(
gem install highline --version "=1.6.2"
Hopefully, I'll be migrating off of this ancient OS soon.
I had similar issues installing cap for CentOS 5.8 but it worked using the rvm installer (to upgrade to latest ruby, I used 1.9.2p320 (2012-04-20 revision 35421) [x86_64-linux])
What I d
I yum remove ruby (to get rid of 1.8.x)
I followed simple instructions at https://rvm.io/rvm/install/ for installing rvm
gem install capistrano
cap command is found!
Hope this helps someones

Resources