I prefer to not ever disable SIP so here's another way to get the bundler gem installed without needing to mess with restricted file permissions and reboot twice.
sudo mkdir -p /usr/local/bin/rubygems
sudo chown user:group /usr/local/bin/rubygems
export GEM_HOME=/usr/local/rubygems/
gem install bundler
Now, you'll probably want to export the GEM_HOME variable in a shell dot file or make a configuration file for gem. You'll certainly need to change the user and group for the chown
command to be your user.
If this doesn't meet your needs, setting up a ruby environment management tool is also +1 in my book.
sudo nvram boot-args="rootless=0";sudo reboot
.