Is there any way to export the last frame of a physics simulation from command line?
Bake the point cache

Using same method as with particles here CLI How to render last frame of hair dynamics sym?

Replace "runs physics simulation" with a bake operator below. Not sure if playing, or frame setting, and baking happen in bg mode as they do when using GUI.

rbw.py

import bpy
context = bpy.context

scene = context.scene
rbw = scene.rigidbody_world
pc = rbw.point_cache

# match bake to animation
print(pc.frame_start, pc.frame_end)


bpy.ops.ptcache.bake({"point_cache": pc}, bake=True)

scene.frame_set(250)
bpy.ops.export_scene.obj(filepath="test.obj")


Testing in CLI with

blender -b xxx.blend -P rbw.py


can confirm  test.obj is a result of simple physics sim at 250.