sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Getting Ruby to work on Mac

    Scheduled Pinned Locked Moved Developers' Forum
    13 Posts 4 Posters 562 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      draftomatic
      last edited by

      Sorry, I thought people would recognize the issue, since there have been other posts about this:

      http://forums.sketchucation.com/viewtopic.php?f=180&t=34219 (someone apparently trying to do the same thing as me, but there is little of use in this thread)

      http://forums.sketchucation.com/viewtopic.php?t=29412 (Dan Rathbun's efforts to use an external ruby installation on PC. Apparently he doesn't own a Mac)

      SketchUp comes with a Ruby interpreter and core libraries, which exists in a .dll in the sketchup directory on PC, and somewhere in the SketchUp package on Mac (/Applications/SketchUp/Contents/Frameworks/Ruby.framework/.....).

      Unfortunately, SU's Ruby does NOT come with the standard libraries (basically, the /lib folder of a Ruby installation), which means it's missing the standard gems, StringIO, ZLib, and many many other useful extension libraries that I need for my plugin. The only way to get these libraries loaded into SketchUp is to append the $LOAD_PATH variable so that calls to Kernal.require will search in your own folders. However, the extension libraries are compiled C code, so I need separate versions for Mac and PC. I tried using libraries that come with the version of Ruby that my Leopard shipped with (1.8.7) (this can be tested by simply finding your native Mac's Ruby installation, in /usr/lib/ruby for me, and adding that path to $LOAD_PATH), but since SU is using a 1.8.5 interpreter on this Mac, I'm guessing this is what is crashing SU when I require these.

      SO, I am trying to find versions of the extension libraries that won't crash sketchup.

      1 Reply Last reply Reply Quote 0
      • jeff hammondJ Offline
        jeff hammond
        last edited by

        forum member driven was messing around with this stuff...

        http://forums.sketchucation.com/viewtopic.php?f=180&t=37127&p=327328

        maybe contact him for some ideas?

        [or fuggedaboutit πŸ˜„ ]

        dotdotdot

        1 Reply Last reply Reply Quote 0
        • D Offline
          draftomatic
          last edited by

          Just found this: http://forums.sketchucation.com/viewtopic.php?f=180&t=28673&start=0#p249370

          Looks to be exactly my problem. I will try linking with a flat namespace tomorrow and see if that will compile a bundle that doesn't crash sketchup.

          1 Reply Last reply Reply Quote 0
          • D Offline
            draftomatic
            last edited by

            I tried compiling a 1.8.5 version of Ruby on the Mac, which works if you follow the directions in the previous post about changing that compiler flag.

            Unfortunately I can't find a 1.8.5 Ruby that includes the thread.bundle C extension. Several of the other C extensions depend on thread.bundle, so I haven't been able to get this working.

            As a workaround I may resort to using shell commands instead of the Ruby libraries I need. This is painful since Mac comes with some programs that Windows does not (tar, gzip), so I'll have to do different things for each platform.

            1 Reply Last reply Reply Quote 0
            • Dan RathbunD Offline
              Dan Rathbun
              last edited by

              See this post for more info (and a link to a StackOverflow post that gives instructions on Mac for changing your symbolic links to force Sketchup to use a System Ruby.)
              http://forums.sketchucation.com/viewtopic.php?f=180&t=31545&start=15#p326274

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • D Offline
                draftomatic
                last edited by

                Thanks Dan.

                Unfortunately since I'm distributing my plugin to other people, I don't see a way to replace the interpreter such that other plugins will be guaranteed not to break. Upgrading SU's Ruby is really only a reasonable solution if you're doing it to YOUR SketchUp and not others'.

                Unless you have something in mind... But otherwise I am still looking for a way to get 1.8.5 standard libraries and extensions into my Mac SU.

                1 Reply Last reply Reply Quote 0
                • Chris FullmerC Offline
                  Chris Fullmer
                  last edited by

                  Isn't it possible to just copy the files you need and require them in your own script? How many standard library files is it?

                  Lately you've been tan, suspicious for the winter.
                  All my Plugins I've written

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    draftomatic
                    last edited by

                    @chris fullmer said:

                    Isn't it possible to just copy the files you need and require them in your own script? How many standard library files is it?

                    I really need a full Ruby installation, including all the C extensions (zlib, stringio, thread, bigdecimal, etc... about 10-15 in total). I achieved this on the PC by copying a 1.8.6 installation into my plugin files.

                    So yes, I could copy files, but my Mac comes with 1.8.7, and the existing extensions in that installation do not work in SketchUp (I get a version difference error). I'm therefore trying to compile a version that will work in SketchUp, but all the 1.8.5 sources I find are missing the thread C extension.

                    1 Reply Last reply Reply Quote 0
                    • Dan RathbunD Offline
                      Dan Rathbun
                      last edited by

                      Well.. probably beatin' a dead horse here, but

                      Ruby v1.8.5 (the entire branch,) is obsolete, and no longer being patched. (Not to mention that the initial release distro'd with Mac Sketchup is superceded by all the later patches.)

                      If I was a Mac only user, I'd be raisin' hell... getting a petition going, or similar to get the Mac Sketchup Ruby updated (at least equal to that of the PC.)

                      It would be nicer if both platforms were updated to the latest patch in the 1.8.7 trunk.

                      I'm not here much anymore.

                      1 Reply Last reply Reply Quote 0
                      • Dan RathbunD Offline
                        Dan Rathbun
                        last edited by

                        @draftomatic said:

                        So yes, I could copy files, ...

                        You can't on the Mac. The extensions need to be linked against the core that Sketchup is going to load.

                        It would be beneficial if you could figure out a way, to install an additional frameworkized v1.8.7 Ruby beneath (alongside) the Sketchup obsolete Ruby, and then have a "switching" utility that allowed the user to change the symbolic links, to load the newer Ruby.

                        I'm not here much anymore.

                        1 Reply Last reply Reply Quote 0
                        • D Offline
                          draftomatic
                          last edited by

                          @dan rathbun said:

                          If I was a Mac only user, I'd be raisin' hell... getting a petition going, or similar to get the Mac Sketchup Ruby updated (at least equal to that of the PC.)

                          It would be nicer if both platforms were updated to the latest patch in the 1.8.7 trunk.

                          I am in the process of raising hell to Google... πŸ˜ƒ

                          @dan rathbun said:

                          It would be beneficial if you could figure out a way, to install an additional frameworkized v1.8.7 Ruby beneath (alongside) the Sketchup obsolete Ruby, and then have a "switching" utility that allowed the user to change the symbolic links, to load the newer Ruby.

                          Sigh... these convoluted workarounds are getting old. I think it will be resort to using shell commands instead of the Ruby libraries I need. Mac comes with curl and gzip, and I believe this will eliminate my need for stringio as well.

                          Thank you for your input Dan. I will pass this on to Google.

                          1 Reply Last reply Reply Quote 0
                          • 1 / 1
                          • First post
                            Last post
                          Buy SketchPlus
                          Buy SUbD
                          Buy WrapR
                          Buy eBook
                          Buy Modelur
                          Buy Vertex Tools
                          Buy SketchCuisine
                          Buy FormFonts

                          Advertisement