Closed afoeder closed 2 years ago
Hi @afoeder. Thanks for buying Ruby on Mac!
As mentioned in this FAQ, Ruby on Mac cannot automatically fix issues with existing projects, especially those with outdated gems. The issues are usually unique to each project. Some issues are more complex to fix than others, which is why I'm introducing the Pro version that includes a 30-min consultation with me for help with older projects.
However, in your case, I'm pretty sure the solution is simple: you need to update the ffi
gem.
The rule of thumb to remember is to see if there is a newer version of the gem that is causing the error. This is usually the gem mentioned at the bottom of the error log. You can check all outdated gems by running bundle outdated
. If so, update it. That resolves most errors.
You are using version 1.15.0 of ffi which is not compatible with M1 Macs. You need to update it to at least 1.15.2, but I recommend updating to the latest version. You can do that by running this command:
bundle update ffi
If that shows an error coming from another gem, or some sort of conflict, then you might need to update several gems at the same time. For example:
bundle update ffi [some other gem]
I hope this helps.
You might also find this guide helpful: https://www.moncefbelyamani.com/how-to-update-gems-in-your-gemfile/
Since I haven't heard back, I'm assuming updating ffi solved the issue and I'm closing the issue. Feel free to reopen if you're still having issues.
Hi @monfresh sorry for not having replied; I also didn't want to stretch your willingness to help :)
After bundle update ffi
I still get basically the same error message but from a slightly newer ffi version,
/Users/adrian/.gem/ruby/2.7.6/gems/ffi-1.15.5/lib/ffi/library.rb:145:in `block in ffi_lib': Could not open library 'glib-2.0.0': dlopen(glib-2.0.0, 0x0005): tried: 'glib-2.0.0' (no such file), '/usr/local/lib/glib-2.0.0' (no such file), '/usr/lib/glib-2.0.0' (no such file), '/Users/adrian/Code/acme/www-public/glib-2.0.0' (no such file). (LoadError)
Could not open library 'libglib-2.0.0.dylib': dlopen(libglib-2.0.0.dylib, 0x0005): tried: 'libglib-2.0.0.dylib' (no such file), '/usr/local/lib/libglib-2.0.0.dylib' (no such file), '/usr/lib/libglib-2.0.0.dylib' (no such file), '/Users/adrian/Code/acme/www-public/libglib-2.0.0.dylib' (no such file)
I am also not at all a ruby guy (that's why I hoped the magic script would chime in anyways) so I'm limited to copy the error message to google but there's also not much stuff. I hope time fixes it when enough other people stumble upon this problem.
thanks and best! -Adrian
Hi @afoeder. Can you please send me the output of these commands:
brew doctor
cat ~/.zshrc
cat ~/.zprofile
cat ~/.bash_profile
cat ~/.profile
And can you also please attach your rom-prime.log
file that's in your Home folder?
Sure!
$ brew doctor
Your system is ready to brew.
$ cat ~/.zshrc
alias rom='cd ~/rubyonmac &&/usr/bin/env bash ~/rubyonmac/rom-prime 2>&1 | tee ~/rom-prime.log'
source /opt/homebrew/opt/chruby/share/chruby/chruby.sh
source /opt/homebrew/opt/chruby/share/chruby/auto.sh
chruby ruby-3.1.2
chruby ruby-2.7.6
eval "$(nodenv init -)"
nodenv global 16.15.1
$ cat ~/.zprofile
eval $(/opt/homebrew/bin/brew shellenv)
$ cat ~/.bash_profile
cat: /Users/adrian/.bash_profile: No such file or directory
$ cat ~/.profile
cat: /Users/adrian/.profile: No such file or directory
Thanks again!
Everything looks good from what you sent, so I'm pretty sure the problem is specific to your Jekyll project. Here's how we can check:
Let's create a brand new jekyll site to test with:
cd ~
mkdir testing-jekyll && cd testing-jekyll
chruby 2.7.6
jekyll new .
bundle exec jekyll build
bundle exec jekyll serve
If that works, then the issue is specific to your project. One more thing you can try is to update all the gems at once, but do that in a separate git branch in case it causes more errors:
git checkout -b update-gems
bundle update
If that still doesn't resolve the ffi issue, I'd be happy to help you via a Zoom session. If you're interested, let me know and I'll email you a discount coupon to upgrade to the Ultimate version, which includes a 30-min session with me (which normally costs $150).
If I don't fix your Jekyll project, then I'll give you your money back, and you can keep the Ultimate version.
One more thing you can try is to go through the gems in your project and make sure you have the required dependencies installed. If the error is complaining about not finding a tool, and updating ffi didn't fix it, then it most likely means one of your gems depends on something to be installed on your machine, which you would typically install via Homebrew.
I see the jekyll_picture_tag
gem in your stack trace. Check their documentation.
Man I'm such a moron, sorry for wasting your time:
brew install vips
🙄
I was distracted / put on the wrong path since ruby-vips
et al was present and the error message "looked like it came from vips", hence "its lacking could not be the issue".
But of course the actually underlying lib was not there, and with it apparently the glib, eventually.
As you've recommended, the docs of jekyll_picture_tag
even state it.
So, thank you thousand times for your effort and your offering, eventually you did nudge me in the right direction. Just needed some rubberducking it seems :)
Thanks again!
You're very welcome! I'm glad it all worked out.
Now that everything is working, could I ask you for a quick favor please? If you're on Twitter, could you write a testimonial about Ruby on Mac? You can mention @rubyonmac and/or @monfresh. Otherwise, would you mind filling out this short survey: https://tally.so/r/wAkaWm
Thanks!
Hi, I don't know if this kind of error is covered by your script or if you could help; it's basically the reason why I've bought it but without luck:
In which version of Ruby on Mac did you find the bug? Prime
Describe the bug I am trying to run Jekyll and still get the following error, both after normal and reset mode:
Details about your Mac Homebrew was installed.
Please attach the Ruby on Mac log file
Thanks again!