Consider brew info --json
https://docs.brew.sh/Manpage#info-abv-options-formulacask-
brew info --json openssl@3 | jq -r '.[0].ruby_source_path'
[
{
"ruby_source_path": "Formula/o/[email protected]",
"ruby_source_checksum": {
"sha256": "7a1131cdb5cb92b8b659c0de4c9b3a3031adf38737553e72eb51e43546ab9ef6"
}
}
]
Though this is wrong after the sharding. correct is Formula/[email protected]
and Aliases/openssl