Skip to content

Instantly share code, notes, and snippets.

@hybridherbst
Last active August 28, 2024 20:20
Show Gist options
  • Save hybridherbst/6a10b41993318abd5bb5d681f4410c10 to your computer and use it in GitHub Desktop.
Save hybridherbst/6a10b41993318abd5bb5d681f4410c10 to your computer and use it in GitHub Desktop.
Building OpenUSD on MacOS

Building OpenUSD on MacOS

Note: This setup is not using virtualenv since I didn't get that to work for building.

Prerequisites

  • install Xcode from App Store
    • alternative: only install the Xcode Command Line Utilities
  • install official CMake
  • install official Python 3.10
  • clone the OpenUSD repo to /Users/herbst/git/OpenUSD
  • switch to right branch (latest release tag recommended, but can also use latest dev)

NOTE: as of 2023-07-11, latest release has a bug with Python 3.10 and PySide6. Building from latest dev works. Alternative: Use Python 3.7 and PySide2

Building from source

cd /Users/herbst/git/OpenUSD # go to OpenUSD folder where the repo was cloned
pip install PySide6 PyOpenGL # install PySide6 and PyOpenGL
PATH="/Applications/CMake.app/Contents/bin":"$PATH" # add CMake to PATH temporarily
xcode-select # just to verify the Xcode command line tools are installed, should log something
/usr/local/bin/python3 build_scripts/build_usd.py /Users/herbst/OpenUSDBuild # run the actual build

Should log:

STATUS: Installing USD...
Success! To use USD, please ensure that you have:
    The following in your PYTHONPATH environment variable:
    /Users/herbst/OpenUSDBuild/lib/python
    The following in your PATH environment variable:
    /Users/herbst/OpenUSDBuild/bin

Set up command line use for Terminal (default: zsh)

  • open /Users/herbst/.zshrc and add the following lines:
export PATH="$PATH:/Users/herbst/OpenUSDBuild/bin"
export PYTHONPATH="$PYTHONPATH:/Users/herbst/OpenUSDBuild/lib/python"

Set up a Quick Action with Shortcuts so you can open with usdview from Finder

  • Command + Space to open Spotlight Search
  • Type "Shortcuts" and hit Enter
  • Click the + button in the top right corner
  • Set "Receive" to "Files"
  • Add "Run Shell Script"
  • Paste the following into the text box:
    export PATH="$PATH:/Users/herbst/OpenUSDBuild/bin"
    export PYTHONPATH="$PYTHONPATH:/Users/herbst/OpenUSDBuild/lib/python"
    usdview Shortcut Input (File Path)
  • Make sure "Use as Quick Action" and "Finder" are checked
@Fulg
Copy link

Fulg commented Aug 28, 2024

Thank you for this. For what it's worth, for OpenUSD release 24.08, I used PyEnv to install Python 3.11.9 as the latest 3.12.x is still unsupported. No specific version of PySide6 was needed. I found that https://vfxplatform.com was a great reference to figure out what is supposed to be supported.

(yes I am new to USD, how can you tell?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment