Launching Rhino for Mac with a runscript argument

As of the most recent RhinoWIP, it’s now possible to launch Rhino for Mac with a -runscript command-line argument.

This expert feature has been around in Rhino for Windows for a while, and it is most frequently used as part of a larger scripted process in which you want to batch process files or automate some repetitive task.

Since this feature has yet to be documented and it differs a little from the Windows counterpart, I thought a post was in order.

How to launch Rhino and run a macro:

  1. Quit Rhino if you already have it open.
  2. Launch the /Applications/Utilities/Terminal.app
  3. At the $ bash prompt, type:
    open /Applications/RhinoWIP.app/ --args -runscript "_Line 0 10,10,10"
    or
    /Applications/RhinoWIP.app/Contents/MacOS/Rhinoceros -runscript "_Line 0 10,10,10"
    and press return

This ought to launch the RhinoWIP, create a new document, and add a line from the origin to 10,10,10
The contents of the script are, obviously, up to you.

With a file:

You can use this in conjunction with a yourfile.3dm argument as well and this will run the script after opening that model. For example:

/Applications/RhinoWIP.app/Contents/MacOS/Rhinoceros ~/Desktop/yourfile.3dm -runscript "_Line 0 10,10,10"

will launch Rhino, open yourfile.3dm, and run the macro/script you provide.

For Longer scripts:

For longer scripts, it’s probably wiser to author them with Python, and then use the -_RunPythonScript command and pass the path to your script file:

/Applications/RhinoWIP.app/Contents/MacOS/Rhinoceros -runscript "-_RunPythonScript /full/path/to/yourpythonscript.py"

As always, please let us know when you find bugs.

@KelvinC I think I remember you documenting this, but I can’t find it. Can you please point us to the official documentation for this?

@dan
It’s here.
http://docs.mcneel.com/rhino/7mac/help/en-us/index.htm#information/startingrhino.htm%3FTocPath%3DGeneral%20information|_____5