RVM and thin, root vs. local user

RVM comes with a handy wrapper generator that creates an intermediary loader for an init.d script. This allows you to load a service using a particular Ruby version and gemset. I use it like this (after installing the thin gem): 1 – create init.d entry for thin sudo thin install 2 – set up some … Read more

rails bundle clean

If you are using Bundler 1.1 or later you can use bundle clean, just as you imagined you could. This is redundant if you’re using bundle install –path (Bundler manages the location you specified with –path, so takes responsibility for removing outdated gems), but if you’ve used Bundler to install the gems as system gems … Read more

What is the difference between Gemfile and Gemfile.lock in Ruby on Rails

The Gemfile is where you specify which gems you want to use, and lets you specify which versions. The Gemfile.lock file is where Bundler records the exact versions that were installed. This way, when the same library/project is loaded on another machine, running bundle install will look at the Gemfile.lock and install the exact same … Read more

ld: library not found for -lzstd while bundle install for mysql2 gem Ruby on macOS Big Sur 11.4 Apple M1

Step 1: confirm you have both openssl and MySQL installed via brew brew install mysql brew install openssl or if you have previous version of openssl try brew reinstall openssl@3 Step 2: Run this on your Rails app to make sure you can get through bundler: gem install mysql2 -v ‘0.5.3’ — –with-opt-dir=$(brew –prefix openssl) … Read more

How to use bundler behind a proxy?

OSX & Linux export http_proxy=http://user:password@host:port export HTTP_PROXY=$http_proxy If it’s using HTTPS, set it as well export https_proxy=http://user:password@host:port export HTTPS_PROXY=$https_proxy If you use sudo, by default sudo does not preserves http proxy variable. Use -E flag to preserve it $ sudo -E bundle install to make sudo preserves environment variables by default: https://memset.wordpress.com/2010/10/14/bash-http_proxy-from-a-user-environment-to-sudo-one/ Windows As pointed … Read more