How to build native Ruby gems on OS X - step by step guide

That is not where SketchUp really wants gems. In SketchUp’s Ruby console type:

ENV["GEM_HOME"]

or

ENV["GEM_PATH"]

Sketchup sets these paths in the ENV hash (ie, the SketchUp process’ copy of the environment,) during it’s startup cycle (when it loads RubyGems.)

It would be nice if there was a SketchUp specific gem server on the sketchup server.

But (until then) you could place it at rubygems, but rename it “yajl-sketchup-ruby-2.0-mac-1.2.1” and then SketchUp (on Mac) could load the latest version it via:

Gem::install "yajl-sketchup-ruby-2.0-mac"

See if you go the plugin-sub-folder route, you risk the possibility of other authors doing the same, and having conflicting versions of the same gem loading from separate author’s plugins.

But I understand you need to keep moving forward, even if this mode is not the best. Perhaps next release things are deployed in a better manner.

Another option is to release the gem packaged specifically as a SketchUp extension, that adds it’s path into $LOAD_PATH, but does not actually load itself into memory. It lets other extensions require it to be loaded, (like we would any standard library module.)

I had an example of this with the ruby-zip gem. (But I cannot find where I posted it. I thought it was here in the Ruby API category.)

Ref other threads: