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

    Ruby Version for Sketchup 8.0 M1 on Mac ??

    Scheduled Pinned Locked Moved Developers' Forum
    41 Posts 6 Posters 3.6k Views 6 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.
    • jeff hammondJ Offline
      jeff hammond
      last edited by

      that's pretty much chinese to me (and i speak/read zero chinese).. but if i type ruby -v in terminal i get:

      ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]

      (the earlier 1.8.5 output was given to me when typing the constants in the su ruby window)

      dotdotdot

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

        Thanks Jeff ... that'll do.

        It shows that Sketchup is loading it's own copy of the Ruby interpreter (which is obsolete, by the way. The entire 1.8.5 branch has been "retired" and is no longer being updated.) SU Mac still is running the initial release of a dead Ruby branch!

        There is a symbolic link in the SU app folders (somewhere,) pointing at the old Ruby in the Ruby.Frameworks/Versions/A

        I don't have a Mac.. but there must be a way for you guys to point that link at your up to date "system" Ruby.

        I'm not here much anymore.

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

          %(#0040FF)[...$ ruby -v
          ruby 1.8.6 (2009-06-08 patchlevel 369) [universal-darwin9.0]]
          and on OSX 10.5.8, I've got a different version to Jeff

          learn from the mistakes of others, you may not live long enough to make them all yourself...

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            @driven said:

            %(#0040FF)[...$ ruby -v
            ruby 1.8.6 (2009-06-08 patchlevel 369) [universal-darwin9.0]]
            and on OSX 10.5.8, I've got a different version to Jeff

            Did you do that from SketchUp's ruby console, or from OSX's command console?

            Thomas Thomassen — SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

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

              Terminal,

              trying to work out how to point SU at that one at least...

              what version is used on PC SU now?

              learn from the mistakes of others, you may not live long enough to make them all yourself...

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

                @dan rathbun said:

                I don't have a Mac.. but there must be a way for you guys to point that link at your up to date "system" Ruby.

                the path to version 8.5

                /Applications/Google\ SketchUp\ 8/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/A/Ruby

                but how to point it to system version??

                learn from the mistakes of others, you may not live long enough to make them all yourself...

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

                  @driven said:

                  %(#0040FF)[...$ ruby -v
                  ruby 1.8.6 (2009-06-08 patchlevel 369) [universal-darwin9.0]]
                  and on OSX 10.5.8, I've got a different version to Jeff

                  I recently updated everything to snow leopard so I guess apple has the latest ruby in there.

                  dotdotdot

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

                    @unknownuser said:

                    @driven said:

                    I recently updated everything to snow leopard so I guess apple has the latest ruby in there.

                    Another question for Apple MRI Ruby .. how does a Mac owner update there Ruby ?

                    Does their "system" Ruby come with RubyGems preinstalled ?
                    Or do they need to go to an Apple website to download a Ruby update?

                    I'm not here much anymore.

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

                      @driven said:

                      @dan rathbun said:

                      I don't have a Mac.. but there must be a way for you guys to point that link at your up to date "system" Ruby.

                      the path to version 1.8.5

                      /Applications/Google\ SketchUp\ 8/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/A/Ruby

                      but how to point it to system version??

                      check the Apple Help website on using, creating and editing symbolic links.

                      If you figure out how to do it.. post a "How To" here at SCF.
                      (Suggest if possible to back up the old symbolic link, before changing it.)

                      I'm not here much anymore.

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

                        @driven said:

                        what version is used on PC SU now?

                        Sketchup 8.0 M0 and M1 come "out-of-the-box" with v1.8.6-p287, but it is very easy to change that on PC by replacing the DLL (as long as it's in the 1.8 trunk.)

                        I'm not here much anymore.

                        1 Reply Last reply Reply Quote 0
                        • W Offline
                          wdbao
                          last edited by

                          i want to extend the build_in sketchup interpreter too.
                          from the release note post by google here http://cfcl.com/twiki/bin/view/Projects/SketchUp/RE_Library_Use
                          Su 8.0 on pc has a 1.8.6 and a 1.8.5 on mac
                          the new 8.0 M1 release note says nothing about the ruby version. so i assume it is still the same.
                          here http://cfcl.com/twiki/bin/view/Projects/SketchUp/RE_Library_Use
                          Main.RichMorin post sth interesting. He also try to extend ruby inside su to other parts of the library, gems, etc.
                          it semms that he hasn't work it out yet.
                          but it's worth a try.
                          and i hope some gurus follow this path and somebody find a way eventually
                          note that even on pc it is 1.8.6 all right, but it has very limited access to the standard library and gems.
                          i try to use CSV class, but it fails.

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

                            @wdbao said:

                            i try to use CSV class, but it fails.

                            See this post: http://forums.sketchucation.com/viewtopic.php?f=180&t=34381&p=302974#p302974

                            I'm not here much anymore.

                            1 Reply Last reply Reply Quote 0
                            • W Offline
                              wdbao
                              last edited by

                              @dan rathbun said:

                              @wdbao said:

                              i try to use CSV class, but it fails.

                              See this post: http://forums.sketchucation.com/viewtopic.php?f=180&t=34381&p=302974#p302974

                              Thanks again! Dan!
                              you are a very good helper. and fast.
                              you have showed me this load path code before. i just couldn't understand it fully then. now with more ruby reading, it all make sense to me.
                              it feels great to be in a such nice community.
                              i will keep read on.

                              1 Reply Last reply Reply Quote 0
                              • S Offline
                                slbaumgartner
                                last edited by

                                @driven said:

                                @dan rathbun said:

                                I don't have a Mac.. but there must be a way for you guys to point that link at your up to date "system" Ruby.

                                the path to version 8.5

                                /Applications/Google\ SketchUp\ 8/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/A/Ruby

                                but how to point it to system version??

                                Not for the faint of heart, but here's how:

                                • quit sketchup
                                • open a terminal window
                                • cd /Applications/Google\ SketchUp \8/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions
                                • sudo mv A A.orig
                                • sudo ln -s /System/Library/Frameworks/Ruby.framework/Versions/1.8 A

                                Restart SketchUp, open a Console window, and type VERSION. If all went well, it should report the same version as when you type ruby -e "puts VERSION" in a console window.

                                To undo this hack, in the same Versions folder:

                                • sudo rm A
                                • sudo mv A.orig A
                                1 Reply Last reply Reply Quote 0
                                • D Offline
                                  driven
                                  last edited by

                                  Hi Steve,
                                  I run as an admin, but not root, I need sudo for anything outside user space.
                                  'Content' folders should have User read/write permissions, I thought.
                                  I also run multiple copies of SU, the path for this one differs from norm and yours. [that may be the splat]

                                  the other thing I have now added sleep 1 and a return before the cd / to reopen SU in both methods.

                                  I may have done blanket permission change using Sketchup.app >> right click >> more info and change for all enclosed files, but I don't think so... but that should work to avoid 'sudo'.
                                  alternatively do that to your 'User' folder after installing SU there?

                                  just using the bits needed for a restart seems handy as well.

                                  learn from the mistakes of others, you may not live long enough to make them all yourself...

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

                                    @John: The global constant VERSION is deprecated because every class and module should have one that specifies it's version, but if the global is defined, it will get inherited into every class and module, and it's easy to assume the inherited one is a specific module version.

                                    Example at the console:
                                    module Dan; end %(#008000)[>> nil] Dan.module_eval("VERSION") %(#008000)[>> 1.8.6]

                                    Oh look, module Dan is version 1.8.6 ?

                                    Not really:
                                    Dan::VERSION %(#008000)[>> Error: #<NameError: (eval): uninitialized constant Dan::VERSION> (eval)]

                                    Use RUBY_VERSION instead. (As well as the other constants that are prefixed RUBY_ ... please.)


                                    @Steve: Please don't quote codeblocks. Besides wasting space (and SCF bandwidth,) it just clones errors, and the original poster of the code may make corrections to the code, which will not be propagated into your quote. (I wish the quote feature would auto-strip them and insert a link back to the quoted post.)

                                    (pssst... you can edit your post and delete the quoted code.)

                                    😄

                                    I'm not here much anymore.

                                    1 Reply Last reply Reply Quote 0
                                    • S Offline
                                      slbaumgartner
                                      last edited by

                                      @driven said:

                                      Hi Steve,
                                      just got back and tested your method, works a treat, so I worked out a Ruby Console 'none sudo' version that works here, if it works for you I'll make it into a toggle button for switching from inside SU...

                                      yes Dan I'll wrap it in a module...
                                      john

                                      Hi John,

                                      On my Mac, the folders and files involved all have root ownership and rwxr-xr-x permissions, so without sudo I could change nothing. When I tried this script, SketchUp crashed (no bugsplat, just vanished!), and nothing changed. You aren't running as root are you? I can see how, after changing permissions, your script would be useful for toggling back and forth between versions, but I don't understand how it can work without either that tweak or sudo?

                                      Steve

                                      P.S. OK Dan, I deleted the code block

                                      1 Reply Last reply Reply Quote 0
                                      • S Offline
                                        slbaumgartner
                                        last edited by

                                        @driven said:

                                        Hi Steve,
                                        I run as an admin, but not root, I need sudo for anything outside user space.
                                        'Content' folders should have User read/write permissions, I thought.
                                        I also run multiple copies of SU, the path for this one differs from norm and yours. [that may be the splat]

                                        the other thing I have now added sleep 1 and a return before the cd / to reopen SU in both methods.

                                        I may have done blanket permission change using Sketchup.app >> right click >> more info and change for all enclosed files, but I don't think so... but that should work to avoid 'sudo'.
                                        alternatively do that to your 'User' folder after installing SU there?

                                        just using the bits needed for a restart seems handy as well.

                                        Hmm...there is a school of though that says ordinary users shouldn't be able to tamper within the subfolders of an app bundle, since they can destabilize the app in arbitrary ways. I once ran a utility that "fixes problems due to permissions", and I wonder if it reset the SU folders and files based on that thinking? Horse is out of the barn now, so without removing and reinstalling SU it's impossible for me to be sure. Maybe if another Mac user is watching this, they can look at their folders before either of our tweaks and tell us what permissions they see? The answer would be important so that your script could be shared successfully.

                                        On a more basic level, after switching to 1.8.7, why would someone want to switch back? The only reason I have thought of is if you are writing plugins for the general Mac community, you might want to verify that they run on the as-installed SU with 1.8.5. So far, I haven't run into any old ones that won't run on 1.8.7. And if I do, provided they were distributed as open code, I'd be more inclined to fix them than to switch back to 1.8.5 just for their sake!

                                        I had seen the problem Dan cites when I used the new Ruby console the Trimble guys posted on GitHub - VERSION on it returns 0.0.1; you have to use RUBY_VERSION to get the right string.

                                        Steve

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

                                          @slbaumgartner said:

                                          Hmm...there is a school of though that says ordinary users shouldn't be able to tamper within the subfolders of an app bundle, since they can destabilize the app in arbitrary ways.

                                          I've never considered myself ordinary maybe ornery root and admin read/write same for V8 on my wife's machine

                                          @unknownuser said:

                                          On a more basic level, after switching to 1.8.7, why would someone want to switch back?

                                          I was thinking that this would be more for Dev's and/or the curious, and if you add an -n flag, to the open cmd you can have both at once in two separate instances of Sketchup.

                                          @unknownuser said:

                                          So far, I haven't run into any old ones that won't run on 1.8.7.

                                          Well, oddly enough the code I first had for this, would only work from 1.8.5 >> 1.8.7 but not back down.
                                          It took me ages to find the same layout that would work in both Thread.new requires a block in 1.8.7, but will work in 1.8.5 with or without.

                                          @unknownuser said:

                                          you have to use RUBY_VERSION to get the right string.

                                          Steve
                                          I always do, i didn't realise VERSION would work at all until you posted it...
                                          john

                                          learn from the mistakes of others, you may not live long enough to make them all yourself...

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

                                            @driven said:

                                            @slbaumgartner said:

                                            ... you have to use RUBY_VERSION to get the right string.
                                            I always do, I didn't realize VERSION would work at all until you posted it... john

                                            From the Ruby v1.8.6-p398 API Core Reference, for Object constants:
                                            Object_Constants_1_8_6.PNG
                                            The caption "obsolete constants" is supposed to be in a right margin, but the DarkFish doc generator didn't do that. It shoved the right margin text under the first item in the left column.

                                            A check of the online doc for v1.9.x shows they have finally been removed.
                                            see: Ruby Core v1.9.3: Object

                                            🤓

                                            I'm not here much anymore.

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

                                            Advertisement