Accidental Technologist

Musings about Entrepreneurship, Technology and Software Development

  • Home
  • About
  • Still River Software
  • Privacy Policy

Powered by Genesis

Fix Installation of Ruby using rbenv on macOS Big Sur

April 26, 2021 by Rob Bazinet Leave a Comment

Tweet

I’ve been using with rbenv to manage installation and switching of Ruby versions for the pass year and have been very happy with it. I recently took the plunge and upgraded my main Apple MacBook Pro from macOS Catalina to Big Sur. Everything seemed to work well after the upgrade. Until I tried to install a new version of Ruby.

Problem

When performing the usual command to install Ruby with rbenv, I started getting this message:

~ $ rbenv install 2.6.7
Downloading ruby-2.6.7.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.7.tar.bz2
Installing ruby-2.6.7...
ruby-build: using readline from homebrew
BUILD FAILED (macOS 11.2.3 using ruby-build 20210423)
Inspect or clean up the working tree at /var/folders/mq/tlm78wy92v54ygbzfykqc8640000gn/T/ruby-build.20210424214159.42314.u6mGui
Results logged to /var/folders/mq/tlm78wy92v54ygbzfykqc8640000gn/T/ruby-build.20210424214159.42314.log
Last 10 log lines:
        rb_native_mutex_destroy(&vm->waitpid_lock);
        ^
vm.c:2489:34: warning: expression does not compute the number of elements in this array; element type is 'const int', not 'VALUE' (aka 'unsigned long') [-Wsizeof-array-div]
                             sizeof(ec->machine.regs) / sizeof(VALUE));
                                    ~~~~~~~~~~~~~~~~  ^
vm.c:2489:34: note: place parentheses around the 'sizeof(VALUE)' expression to silence this warning
compiling dmyenc.c
1 warning and 1 error generated.
make: *** [vm.o] Error 1
make: *** Waiting for unfinished jobs....
~ $

Trying to figure out the problem by looking at the message, it didn’t seem like something I could fix. Searching the rbenv Github issues didn’t give many clues. Knowing that rbenv uses ruby-build to automate the Ruby build process, I looked at the issues reported. It looks like I was not the only one having similar problems.

CleanShot 2021 04 24 at 21 51

I tried several of the suggestions found from those issues and none of the solutions worked.

Solution

I decided to turn to my friends on Twitter to see if anyone had faced this issue. Twitter never lets me down and Robby Russell of Planet Argon came through,  suggesting installing Ruby with these CFLAGS:

CFLAGS="-Wno-error=implicit-function-declaration" rbenv install 2.6.7

It worked perfectly and I was able to get additional versions of Ruby installed. This should also work if you’re having problems with asdf Ruby version manager too. Asdf uses ruby-build behind the scenes.

I wondered why I hadn’t stumbled on this solution in the ruby-build issues on Github. It turned out I saw the issue but ignored it because it referenced installing older versions of Ruby when Xcode 12 was installed. I have Xcode 12 but was installing new versions of Ruby. The ticket was a little deceiving as it worked with new versions as well.

For those interested in the details, they can be found in the ticket – Installing older Ruby versions on OSX after Xcode 12.

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: Mac, Ruby Tagged With: rbnev, Ruby

Installing RMagick on macOS Sierra

February 3, 2017 by Rob Bazinet 5 Comments

Tweet

I ran into a problem recently on macOS Sierra, trying to install the RMagick ruby gem. I was using ImageMagick 7 installed via HomeBrew, with this error:

Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
current directory: /Users/rbazinet/.rvm/gems/[email protected]_admin/gems/rmagick-2.16.0/ext/RMagick
/Users/rbazinet/.rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20170203-49311-bi1omy.rb extconf.rb
checking for gcc... yes
checking for Magick-config... no
checking for pkg-config... yes
checking for outdated ImageMagick version (<= 6.4.9)... no
checking for presence of MagickWand API (ImageMagick version >= 6.9.0)... no
checking for Ruby version >= 1.8.5... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no
Can't install RMagick 2.16.0. Can't find MagickWand.h.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/rbazinet/.rvm/rubies/ruby-2.3.1/bin/$(RUBY_BASE_NAME)
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/rbazinet/.rvm/gems/[email protected]_admin/extensions/x86_64-darwin-15/2.3.0/rmagick-2.16.0/mkmf.log
extconf failed, exit code 1

After a bit of trying to install the gem by setting the C_INCLUDE_PATH to the location of the MagickWand.h file, the gem could still not be installed. A Google search revealed the solution. It seems the RMagick gem (v 2.16.0 as of this writing) is not compatible with ImageMagick 7.

The StackOverflow articles points outthe necessary steps to get it to work:

Install version 6 (uninstall existing imagemagick if needed):

brew install [email protected]

Since this is keg-only, you should then force-link it:

brew link --force [email protected]

This installed imagemagick version 6.9.7-4 for me.

Afterwards, the gem then installed successfully. I am including the version numbers for future readers:

This solution worked great and RMagick installed without having to jump through any other hoops. Hope this helps.

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: Ruby Tagged With: macOS Ruby RMagick ImageMagick

Fix Ruby Malloc Error on macOS Sierra

October 13, 2016 by Rob Bazinet 1 Comment

Tweet

After upgrading my iMac to macOS Sierra I have experienced a few issues that I thought I’d document here, both for myself and to help others.

Problem

The latest issue I found when trying to run a rails console command for a client application. The result was a hung terminal session and this message:

ruby(50426,0x7fff96cd43c0) malloc: *** malloc_zone_unregister() failed for 0x7fff96cca000

I’ve never seen this one before and with the terminal session hung, I had no real way to debug. Thanks to Stackoverflow, the solution was pretty simple.

Solution

What I found pointed to the Skylight gem version (0.8.1) I was using. Changing the version 0.10.6, bundling and running the console again fixed the issue.

I wondered about the root cause the issue though and did a bit of research to see if I could figure out why this one gem caused such a failure. Knowing what I know about the Skylight gem and being developed at least partially using Rust, I started there. Looking at the Skylight gem source, there is indeed references to using Rust.

A bit of spelunking Rust issues revealed there were some issues with earlier macOS Sierra betas. I was using 0.8.1 of the Skylight gem, built before Rust was fixed. One in particular looked very suspect.

Everything is working great now. I hope this helps someone with this really odd error.

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: Ruby Tagged With: Ruby, rust, skylight

Fixing Nokogiri Installation on macOS Sierra

October 1, 2016 by Rob Bazinet 5 Comments

Tweet

Nokogiri seems to be the source of many problems on my Mac and after upgrading to macOS Sierra, I wasn’t very surprised to have problem.

Problem

You may get an error similar to:


ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
Using pkg-config version 1.1.7
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.1.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.4.

Suggesting using system libraries with:

gem install nokogiri -- --use-system-libraries

Which leads to other less than helpful suggestions.

Solution

It seems after the macOS upgrade and moving to Xcode 8.0, command line tools were not installed.

I was able to get Nokogiri installed by first installing the Xcode command line tools:

xcode-select --install

Then install Nokogiri using the system libraries:

gem install nokogiri -- --use-system-libraries

I hope this helps someone trying to solve a problem that seems should have been solved better by now.

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: Ruby Tagged With: nokogiri macos rubygem

Life Beyond Rails: A Brief Look at Alternate Web Frameworks for Ruby

February 17, 2015 by Rob Bazinet Leave a Comment

Tweet

I wrote up a list of alternative Ruby web frameworks some time ago and now Engine Yard has published a new list. Some of my original picks are in there, so it’s great to see they’ve continued.

A couple notables include Volt, for running Ruby on the server as-well-as the client, and Cramp that helps with needing a lot of open connections and bi-directional communication.

A great list to check out.

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: Ruby Tagged With: Ruby, Ruby on Rails

Use TinyURL from Ruby

June 6, 2013 by Rob Bazinet Leave a Comment

Tweet

I recently found myself needing to use TinyURL on a client project. ?I did a bit of scouring the web for some Ruby code to solve the problem but with little success. ?Much to my surprise they don’t have an available API, but they do have a way to access over HTTP.

This is a simple Ruby class to use TinyURL. ?Note: this depends on HTTParty, so add to your project.

class Tinyurl 
include HTTParty
base_uri 'tinyurl.com'

def shorten(url)
self.class.get("/api-create.php?url=#{url}")
end
end

You can find the Gist on Github. Hopefully you find this code useful. Enjoy!

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: Ruby Tagged With: httparty, Ruby, tinyurl

I Backed The Ruby 2.0 Walkthrough on Kickstarter and So Should You

November 9, 2012 by Rob Bazinet Leave a Comment

Tweet

Ruby20

It was announced at RubyConf that Ruby 2.0 would be released in February 2013 and a preview available immediately. ?If you use rvm, you can try it out pretty easily.

The problem is, there are many changes coming. ?How are you going to know what’s different from Ruby 1.9.x? ?What about all the way back to 1.8.x? ?I think it will take any one of us a significant amount of time to sort it all out, but it doesn’t have to.

There really is a rather simple answer; it’s a Kickstarter project by our Ruby friend Peter Cooper called The Ruby 2.0 Walkthrough. ?Peter is looking for a small sum of money to help pay for his time to create this valuable asset.

What do you get?

Ruby 2.0 launches in February 2013 and at that time I’ll be selling the screencasts alone for $19 and the screencasts + e-book for $29. By backing the project now, you’ll get the same material for less and depending on what tier you go for you could get access to special bonuses and benefits that I WON’T be offering when it goes on general sale (like update e-mails, consultancy time or a limited PRINT edition). Also, having people pledge to the project will ensure I stick to it and get it done which is the main motivation for this campaign.

I am backing this project and so should you. ?Why? ?

  • The resource created will be valuable to everyone moving to Ruby 2.0.
  • The small amount of money to back the project will pay for itself in the time you save. ?Minutes based on your hourly rate, I’m sure.
  • Peter would like your support. ?He provides so much value to our community with his weekly newsletters for Ruby, JavaScript, HTML5 and others, that when someone so giving asks for support..it’s a no-brainer.
  • Peter needs the pressure from us, by raising the money to get it done.
Head over to Kickstarter and support The Ruby 2.0 Walkthrough. ?Many less worthy projects have been funded.

?

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: Ruby Tagged With: kickstarter, peter cooper, Ruby

Get Your RubyTapas On

October 23, 2012 by Rob Bazinet Leave a Comment

Tweet

Rubytapas

I really love the efforts being put forward by people in our developer community, lots of cool new tools and especially screen casts. ?Screen casts are a great way to spend some time and learn something new.

One new screen cast that has quickly become one of my favorites is RubyTapas by Avdi Grimm. ?Avdi is a speaker, writer and a Ruby Rouge.

What’s RubyTapas?

These are short, 2.5 to 7 minutes in length, but are laser focused on a very specific aspect of Ruby and published 3 times a week.?

RubyTapas is for the busy Ruby or Rails developer who is ready to reach the next level of code mastery. Short screencasts three times a week will introduce you to a wide variety of intermediate to advanced Ruby concepts and techniques, as well as core Object-Oriented design principles. Lead by head chef Avdi Grimm (author of Exceptional Ruby and Objects on Rails), you?ll go from journeyman to master, one small, tasty plate at a time.

As I write this Avdi has published his 13th episode which covers singleton objects. ?The growing list of episodes can be found on the RubyTapas site. ? Subscribing to the full list requires a subscription, only $9 per month..so a great deal.

What’s to love about these?

Each episode is a super focused topic, great video and great sound. ?This isn’t the best part in my humble opinion; each episode comes with a very well commented Ruby file as well as an HTML document containing the episode explained so you can get a deeper understanding of the concept. ?

I have gone through all the episodes and they are pure Ruby, no Rails no Sinatra..just pure Ruby. ?I have been working with Ruby for a good number of years and I am learning a bunch from these, great style and techniques. ?I wouldn’t say they are for beginners but your mileage may vary.

I’m not affiliated with Avdi at all, just a happy subscriber. ?It’s sometimes hard to filter the good from the bad out there.??

Happy Hacking!!

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: Ruby Tagged With: Ruby, rubytapas

Goruco 2011

June 8, 2011 by Rob Bazinet Leave a Comment

Tweet

IMG 0070

I had never had the opportunity to attend Goruco in New York City before, not because I couldn’t make it but rather because I wasn’t fast enough to get a ticket before the conference sold out. ?Now I can understand why it sells out so fast, it is a fantastic conference run by a great group and organized with precision.

I decided to make the trip from CT to NYC the same day as the conference and return the evening after it ended, making for a long day indeed. ?Getting up at 3:30 AM seems almost unnatural to drive an hour to meet a friend to make the trip by train from New Haven and arriving at Grand Central Station just after 7:30 AM with my friend and fellow Rubyist, Mike Morris of RecDesk (great software for your recreation department, by the way).

A short trip by subway to lower Manhattan put us at Pace University with plenty of time to settle into the conference.

The Venue

Pace University is the host for Goruco and has been in the past. ?Since it is a university and setup to handle students, it makes a perfect back drop to spending the day talking about Ruby. ?The setting in downtown Manhattan is a great place in a wonderful city.

IMG 0083

Just a short walk from Pace visitors are treated with the new World Trade Center under construction.

The Lineup of Talks

Whenever I attend a conference there are always talks that stand out for me, either because the content is great or the topic is something I am working on or interested in at the moment or maybe both.

IMG 0079

As you can see here, Evan Phoenix waves to the crowd while demonstrating some sleight of hand.

There were 7 talks plus RejectConf and of the seven,?Jeremy Ashkenas’s talk titled?Coffeescript for the Well-Rounded Rubyist and?Evan Phoenix’s talk,?Build it and they will come (Rubinius Edition) were the two talks that stood out. ?Jeremy is the creator of?CoffeeScript and Evan the creator of?Rubinius and this fact alone makes their deep knowledge shine through. When a speaker knows a subject as deep as these two, it’s obvious in the delivery and the their ability to answer any question in great detail.

The announcement at RailsConf that CoffeeScript would be included by default in Rails 3.1 and the fact that I have never enjoyed writing JavaScript meant I really was looking forward to this talk. ?I had been playing around with CoffeeScript recently after listening to the screencasts from RailsCasts and PeepCode and really liked what I saw. ?An opportunity to hear the creator of CoffeeScript, Jeremy Ashkenas, speak could not be passed up. ?

Engine Yard has been 100% committed to Ruby and the development of Rubinius for a long time and this level of commitment has piked my interest over the past several months. ?I have spend time with Rubinius, testing my applications and using it for new development. ?It has been very stable and performant and I look forward to the day it supports 1.9.x. ?I think once we see version 2.0 will be the time to start moving Rubinius to production. ?So this talk was important to me and Evan did not disappoint. ?He laid out a clear roadmap for the product with a call to action for developers to use it, report bugs and help fix them.

The other 5 talks were also really good, along with the end of day lightening talks made for a day of learning.

New Friends

I met up with a lot of folks who I only knew from Twitter, blogs or some other way. ?I always find it interesting to walk around and try to catch a glimpse of people’s name badges to see if they are familiar. ?It’s also interesting to try to match a Twitter avatar to a real face.

I am glad for the opportunity to meet these people finally face-to-face.

Missed Opportunities

The conference organizers planned for a cruise on the Manhattan water which included dinner and drinks but our lack of planning left us to only watch as others sailed off. ?After a dinner and a couple cold beers we headed back to CT. ?The trip home seemed like a longer journey than our arrival, finally getting in at 2:00 AM.

I would have liked to spend the entire weekend in the city and attend all the activities the organizers planned but timing didn’t work out. ?I am sure everyone had a great time.

Next Year

It was a great event covering a great day. ?I plan to be back next year but I will be spending the weekend in the city and hopefully there will be another cruise at Goruco 2012.

If I had one suggestion to make to those planning Goruco next time, I wouldn’t mind seeing this as a two-day event full of talks.

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: Ruby Tagged With: coffeescript, goruco, rubinius, Ruby

Makandra Notes for Rails Developers

September 30, 2010 by Rob Bazinet Leave a Comment

Tweet

The Ruby Rails consulting shop Makandra recently opened their internal knowledge base of how-tos and code snippets for all to see and use.  The announcement about the project indicates 500+ links:

This September we decided to take our in-house knowledge base and publish it for everyone to see. makandra notes contains some 200 HOWTOs and 500+ links for Ruby, Rails, RSpec, Cucumber and Javascript and is growing every day.

Whether you’re looking to deliver Paperclip attachments securely, test concurrent Ruby code or marry Capybara with SSL-enabled applications, chances are we already solved your problem for you.

The reality is as of this writing, 718 notes are listed.  It?s a good resource and one I hope they add to and either let others contribute to or open source the application for others to use to build internal/external knowledge bases.

The search is fast too and real-time, narrowing down results as I typed.

makandra

Besides having some useful information you can also see the user interface is nice and clean.  The resource is from a Rails shop but it is not just for Rails issues but rather the issues Rails developers deal with each day, from Ruby, Rails and JavaScript to Ubuntu server administration and cron jobs.

Way to go Makandra and thanks for the resource.

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: Ruby Tagged With: Makandra Notes, Ruby, Ruby on Rails

Next Page »

Recent Posts

  • How to Fix Rails Flash Rendering When Using Hotwire
  • Hotwire Fix for CORS Error when using Omniauth
  • Fix Installation of Ruby using rbenv on macOS Big Sur
  • RailsConf 2021 and the Future of Conferences
  • Fixing Out of Diskspace Errors on Amazon EC2

Categories

Services I Love

HatchBox - Easy Rails Deploys Fathom Analytics
Follow @rbazinet

Rob Bazinet
@rbazinet

  • This is so true and has been my personal take on people complaining they are busy - https://t.co/YW8NTQLXtl
    about 3 days ago
  • Wow…https://t.co/h94ia053sL
    about 4 days ago
  • My Bills lost today but more importantly so did the Dallas Cowboys. Nice seeing the ‘boys done for the season.
    about 5 days ago
  • It looks like the Apple Xcode command line tools is a bit bloated for it to take this long… https://t.co/U0HObTvzXf
    about 2 months ago
  • How many people are mad that @elonmusk bought Twitter yet own or plan to own a Tesla? I bet many.
    about 2 months ago
  • RSS - Posts
  • RSS - Comments