Solution with a question:
Short answer:
Using the option --web
solves the problem (see transcript below)
root --web
------------------------------------------------------------------
| Welcome to ROOT 6.36.000 https://root.cern |
| (c) 1995-2025, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for macosxarm64 on Jun 18 2025, 22:42:11 |
| From tags/6-36-000@6-36-000 |
| With Apple clang version 17.0.0 (clang-1700.0.13.5) |
| Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' |
------------------------------------------------------------------
rootLogon
(int) 1
root [0] TCanvas c
Info in <THttpEngine::Create>: Starting HTTP server on port 127.0.0.1:9282
(TCanvas &) Name: c1 Title: c1
root [1] TH2D *my2d = new TH2D("my2d", "my2d", 100, 0, 1, 100, 0, 1)
(TH2D *) 0x12f00e800
root [2] my2d->Draw()
root [3] .q
Question: If --web is the default, as I can see by it opening TBrowser correctly, why do I need to specify that option on the command line if I open TCanvas? I am puzzled by the difference in behavior between TBrowser and TCanvas in terms of the simple opening of a canvas. Not a problem, since I will just redefine my root alias to include --web, but curious?
Long answer:
Following @couet’s reply, I looked at @linev’s post <TBrowser::TBrowser>: The ROOT browser cannot run in batch mode - #3 by linev. There I see that specifying a server and port with the --web=server:port option might be a useful idea. It worked somewhat, in that I had to open a browser (did not automatically appear) and go to the web site printed after the TCanvas call before the TCanvas call timed out. Then I could draw on that canvas.
root [0] TCanvas c
Info in <THttpEngine::Create>: Starting HTTP server on port 127.0.0.1:9898
New web window: http://localhost:9898/win1/?key=5a78e0ae-9c816620-0da8db97-4d460f9a-523e16fc-63f0b5ca-c252eac2-0249c657#52620503-0ac0503c-eb262a91-528834e2-4eb7f603-055ff6cf-f0aab3e3-3863227f
(TCanvas &) Name: c1 Title: c1
This prompted me to try it without specifying the server:port.
Paul