[MacOSX] Troubleshooting with dtruss


In a previous post, I looked at how things could go wrong in the file ~/pymel.log wasn’t accessible. On Windows, this was fairly easy to track down using Process Monitor:
pymel.log

On Mac OS X, I had to use dtruss. For example, I ran this command to trace the syscalls of the Maya Render command:

sudo dtruss -f -t open_nocancel -n Render 2> /var/tmp/mtoarender.log

When the render job failed, I checked the log file, and found this line:

11668/0x35deb: open_nocancel("/Users/stephenblair/pymel.log\0", 0x601, 0x1B6) = -1 Err#13

One important gotcha: if you repeat the render, you won’t find any mention of pymel error in the dtruss output. My guess is that at that point, the Render command ends up going through the file system cache, so dtruss doesn’t see the attempt to find pymel.log.

Here’s a quick summary of the dtruss command I showed above:

  • Use sudo to run dtruss, because it needs additional privileges.
  • -f tells dtruss to follow any child processes (like mayabatch) launched by Render
  • -t filters the trace for open_nocancel system calls
  • -n tells dtruss to trace the process named “Render”
  • 2> /var/tmp/mtoarender.log redirects the dtruss output to a file

[RLM] [MacOSX] Setting solidangle_LICENSE on Yosemite


In Yosemite, Apple removed support for environment variables in launchd.conf, so you need to find another way to set global, system-wide environment variables. For example, if you want solidangle_LICENSE to be automatically set, you could use a launchd plist.

Here’s an example plist that uses launchctl to set the solidangle_LICENSE environment variable.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
        <key>Label</key>
        <string>com.solidangle.setenv</string>
        <key>ProgramArguments</key>
        <array>
        <string>/bin/launchctl</string>
        <string>setenv</string>
        <string>solidangle_LICENSE</string>
        <string>5053@replace-me</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>ServiceIPC</key>
        <false/>
 </dict>
 </plist>

You’ll need to edit this plist and save it in /Library/LaunchDaemons. The file permissions and ownership should look like this:

-rw-r--r--@ 1 root wheel 661 Oct 22 13:52 com.solidangle.setenv.plist

Use sudo chmod to set the permissions, and sudo chown root:wheel to set the ownerships.
Then load the plist:
sudo launchctl load -w /Library/LaunchDaemons/com.solidangle.setenv.plist

And then restart your machine.

References:

[MacOSX] Setting solidangle_LICENSE


There are several ways you can do it.

  • You can use Maya.env to set the solidangle_LICENSE environment variable.

    In your Maya.env file, add this line:

    solidangle_LICENSE=XXXX@SERVER
    

    where XXXX is the port number, and SERVER is the name or IP address of the computer.

    Maya.env is located in your user Library. For example: /Users/steve/Library/Preferences/Autodesk/maya/2014.

    By default, the Library folder is a hidden folder, so you may need to un-hide the Library folder.

  • You can set solidangle_LICENSE as a system environment variable.
    1. Log in with an Administrator account and run this command to open a text editor.
      sudo nano /etc/launchd.conf
      
    2. Add this line to /etc/launchd.conf:
      setenv solidangle_LICENSE XXXX@SERVER
      
    3. Save the file and exit.
    4. Restart the Mac.

If you don’t want to restart your Mac just yet, you can try setting the environment variable like this (it will last until you restart your machine):

launchctl setenv solidangle_LICENSE XXXX@SERVER