3D tutorials, tips and techniques, inspiration and community.

Sunday, December 11, 2011

Opening Multiple Copies of Blender on Mac OSX

Up until recently, I thought that there was no way to have several windows (or copies) of Blender open at the same time on Mac OSX. Actually, this rumor has been spread around both in the Blender forums and in the real world, to the point one would even doubt the validity of using Blender on a Mac—some people in the Win-Blender community can be so snide against the Mac sometimes... :D Not fair.

Anyway, I just discovered a very easy way to get around this apparent limitation. My solution does not involve having several copies of Blender, but rather using the Terminal to open multiple copies of the same Blender application. Yes, the Terminal, that little known utility that scares most Mac users out of their wits, or at least it used to have such an effect on me.

There are two things you need to know about the Terminal. First, you can navigate to any folder in your Mac from within a Terminal window. To do so, you open a new Terminal window, type cd (which stands for change directory,) and enter the name of the folder or file you want to have accessible. After that, just press Enter. The Terminal allows to autocomplete file and folder names by pressing Tab. To make sure you are where you're supposed to be, type ls (for list) and press Enter. That shows you the files in the folder you are viewing. You can type an entire path to a specific folder or file by separating the folder inside folders with a /. To backtrack, type cd .. (that's two dots) and press Enter. To go to the root user folder, type cd ~. These basic commands will allow you to start navigating your Mac from the Terminal.

The second things is that you can perform commands from the Terminal. You can open programs and files, edit them, save the changes. Actually, it can do this and more, but at least it is important to realize that you can open a program from the Terminal. In order to work on a file, you need to navigate to the folder where that file is contained—in the same way that, in order to open a file, you need to go to the folder and double-click on its icon.

Once you can do that, go ahead and start a new Terminal window. Navigate to your Blender application folder. Yes, what we see on the Finder as Blender is not a program, but a package: a special Mac folder that contains the program itself and other files used by the program, like the icons, scripts, and default file. Anyway, navigate inside your Blender package, all the way to the folder where the actual program resides. If you have Blender in the main Applications folder in your Mac, the path to it would be (assuming you start from your user folder):
cd ../../Applications/blender/blender.app/Contents/MacOS/
Then, once you're there, open Blender by typing

./blender

The terminal spews out a couple of unintelligible lines, which I choose to ignore:


ndof: 3Dx driver not found
found bundled python: /Applications/blender/blender.app/Contents/MacOS/2.60/python
[Lux 2011-Dec-11 13:37:01] Using pylux version 0.9 (dev)

In any case, the end result is that you get a new Blender window open, independent of the other(s), and it allows you to work with two files at the same time! Cool stuff. I would suggest saving this text somewhere, either as text or as a script, so that you don't have to enter it manually every time. If I work out a Python script for this, I'll make sure to share it.

Enjoy!

11 comments:

  1. From Niverik2k -
    Also, If you have multiple builds of blender on your mac, you can open each one as well. I do this all the time, when I want to look at something from another blend file.

    ReplyDelete
  2. Yes, you're right, I used to do that, but then I kept losing track of what build I was on :) I think my solution works better for me, but it's a matter of preference.

    ReplyDelete
  3. I'm finding this very useful for compositor heavy animations. The current compositor doesn't make use of all the processing cores that you've got at your disposal, so after a burst of full power processing for the render, the processor kicks back for a bit while just one core churns through what's needed. Opening an new instance of blender for each additional core will keep your processor very busy for the entire render. Very useful indeed, thank you.

    ReplyDelete
  4. Actually, ignore that, isn't too stable and is producing erroneous results. Guess I'll have to wait for the OpenCL compositor to keep all my threads singing and dancing...

    ReplyDelete
  5. Thanks anyway for letting me know about some of the possible implications with multi-core processing. I had no idea it might be used that way. Please keep me posted if you find out anything else in this regard.

    ReplyDelete
  6. Stephen, I was just doing some tests, and I think you're absolutely right. The compositor does not seem to use the full CPU available computing power. I guess we'll have to wait for the compositor improvements announced a while ago.

    ReplyDelete
  7. You can follow my steps to get a launcher in the Dock that can open multiple instances of Blender.

    1) Create a script called "runblender" with these contents:
    ~/LocalApps/blender-2.63a-release-OSX_10.6_x86_64/blender\ 2.63a.app/Contents/MacOS/blender &
    sleep 1

    First is the path-name to the actual blender executable within the app package. '~' gets replaced with your home directory by the shell. '&' means run in the background, which allows the script to quit and leave Blender running. The sleep is apparently needed to work around a timing issue with Automator (see below).

    2) Make the script executable; in the terminal, type: chmod u+x runblender
    Now you can do a test run from the terminal: ./runblender
    And you can do this for as many copies as you like.

    3) In the Automator app, create a new app and select "Run Shell Script" from the library.

    4) Enter the path-name to your script in the shell script box (e.g. ~/runblender if it's in your home dir).
    Click the Run/play button to test run your app. Once it works, save it, e.g. as BlenderLauncher.app.
    Test your launcher app. I found that before I added the "sleep 1" to my script, Blender would not be launched.

    5) Using "Get info" on the Blender app and your launcher app, copy and paste the icon from Blender into your BlenderLauncher.

    6) Drag your new app to the Dock.

    Now you should have a Blender icon in the Doc that can launch as many instances as you like!
    Note that the little white dot will not remain, so don't forget you have it running.

    ReplyDelete
    Replies
    1. And whenever you upgrade Blender, you simply change the path in your script. No need to change the launcher app.

      Delete
  8. Anonymous, thanks for that great tip! I'll have to try it right away! :)

    ReplyDelete
  9. Thanks that was a great help!

    ReplyDelete
  10. Old thread but when combined with: http://stackoverflow.com/questions/281372/executing-shell-scripts-from-the-os-x-dock you can have the link on the dock :D

    ReplyDelete