Out of nowhere today, when I tried to run pod install on my machine, it could not be found. Uh… what?

zsh: command not found: pod

The only thing that changed recently was installing the most recent supplemental update. Otherwise, nothing with my configuration or environment has changed. Even more strange is that other Ruby gems seemed to work fine, like jekyll. Running gem list produced the expected output, and I even verified that the pod binary existed in ~/.gem/bin/ via Finder.

I use rbenv to manage Ruby versions (installed via brew). And my .zprofile contains the following:

export GEM_HOME="$HOME/.gem"
export RBENV_ROOT=/usr/local/var/rbenv
if which rbenv > /dev/null; then
    eval "$(rbenv init -)";

After searching around and finding terrible advice (see below) on Stack Overflow, I decided to add the following to my .zprofile:

export PATH="$HOME/.gem/bin/:$PATH"

This was the sanest solution I could think of, but I do not know if it is the “most correct”. Now everything works as expected. But I honestly have no idea why this change was required now, and why it was not required before. (Or if I should do something else?) *shrugs* Computers, I guess?

I am not a Ruby expert, so if I should be doing something differently, please let me know.

* * *

The bad advice on Stack Overflow that I saw on numerous posts was to use sudo, which is considered bad practice for various reasons. Another bad suggestion was specifying the bindir to /usr/local/bin when installing the gem, which is not typically where you would want gems installed.

# yeah... do NOT do this
sudo gem install -n /usr/local/bin cocoapods