Mac with nogui to run batch cmd

Hi, I'm trying to generate images in batch with chimerax from terminal on mac m2. When I run "chimerax --nogui --exit --cmd" I get the error: raise LimitationError("Unable to save images because OpenGL rendering is not available") chimerax.core.errors.LimitationError: Unable to save images because OpenGL rendering is not available ChimeraX command "graphics driver" gives: OpenGL version: 4.1 Metal -88.1 OpenGL renderer: Apple M2 OpenGL vendor: Apple Is there any way around this? I saw another post about this from 2020 that the nogui option only works on linux with offscreen. Is there any way to save images in batch from terminal? Thanks, Aaron

Hi Aaron, The OpenGL graphics library requires a window to render, so it is not possible to render ChimeraX images without creating a window. But it is fine to have the window iconified. The Linux ChimeraX uses a replacement library for OpenGL called OSMesa (offscreen mesa) which is essentially a version of OpenGL that can work without a window. Back in 2021 I built OSMesa for Intel Mac to render images in nogui mode. https://github.com/RBVI/ChimeraX/tree/release/v1.4/prereqs/osmesa If you built libOSMesa.dylib for ARM Mac somehow then you could use that and put it with the osmesa/__init__.py at the above github link in your ChimeraX Python site-packages directory and it would probably be able to render off-screen images if you started ChimeraX with the --offscreen option. I believe OSMesa does not use graphics hardware acceleration, only the CPU so it will be much slower to render images. Tom
On Dec 10, 2024, at 6:33 AM, aponysbc--- via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi, I'm trying to generate images in batch with chimerax from terminal on mac m2. When I run "chimerax --nogui --exit --cmd" I get the error: raise LimitationError("Unable to save images because OpenGL rendering is not available") chimerax.core.errors.LimitationError: Unable to save images because OpenGL rendering is not available
ChimeraX command "graphics driver" gives: OpenGL version: 4.1 Metal -88.1 OpenGL renderer: Apple M2 OpenGL vendor: Apple
Is there any way around this? I saw another post about this from 2020 that the nogui option only works on linux with offscreen. Is there any way to save images in batch from terminal?
Thanks, Aaron _______________________________________________ ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/

Hi Aaron, The Mac package manager Homebrew has osmesa. So I just did a quick test of offscreen rendering in ARM Mac ChimeraX daily build and it worked. Here's what I did and the test image I saved is attached. Tom $ brew install mesa $ mkdir ~/Desktop/ChimeraX.app/Contents/lib/python3.11/site-packages/osmesa # Download the __init__.py file from https://github.com/RBVI/ChimeraX/tree/release/v1.4/prereqs/osmesa $ mv ~/Downloads/__init__.py ~/Desktop/ChimeraX.app/Contents/lib/python3.11/site-packages/osmesa $ cp -p /opt/homebrew/Cellar/mesa/24.2.8/lib/libOSMesa.dylib ~/Desktop/ChimeraX.app/Contents/lib/python3.11/site-packages/osmesa $ ~/Desktop/ChimeraX.app/Contents/MacOS/ChimeraX --nogui --offscreen cmd> open 1a0m cmd> save test.png cmd> exit 
On Dec 10, 2024, at 10:36 AM, Tom Goddard <goddard@sonic.net> wrote:
Hi Aaron,
The OpenGL graphics library requires a window to render, so it is not possible to render ChimeraX images without creating a window. But it is fine to have the window iconified. The Linux ChimeraX uses a replacement library for OpenGL called OSMesa (offscreen mesa) which is essentially a version of OpenGL that can work without a window. Back in 2021 I built OSMesa for Intel Mac to render images in nogui mode.
https://github.com/RBVI/ChimeraX/tree/release/v1.4/prereqs/osmesa
If you built libOSMesa.dylib for ARM Mac somehow then you could use that and put it with the osmesa/__init__.py at the above github link in your ChimeraX Python site-packages directory and it would probably be able to render off-screen images if you started ChimeraX with the --offscreen option. I believe OSMesa does not use graphics hardware acceleration, only the CPU so it will be much slower to render images.
Tom
On Dec 10, 2024, at 6:33 AM, aponysbc--- via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi, I'm trying to generate images in batch with chimerax from terminal on mac m2. When I run "chimerax --nogui --exit --cmd" I get the error: raise LimitationError("Unable to save images because OpenGL rendering is not available") chimerax.core.errors.LimitationError: Unable to save images because OpenGL rendering is not available
ChimeraX command "graphics driver" gives: OpenGL version: 4.1 Metal -88.1 OpenGL renderer: Apple M2 OpenGL vendor: Apple
Is there any way around this? I saw another post about this from 2020 that the nogui option only works on linux with offscreen. Is there any way to save images in batch from terminal?
Thanks, Aaron _______________________________________________ ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/
participants (2)
-
aponysbc@gmail.com
-
Tom Goddard