Follow-up: I think this can be pinned down without the .command.err after all, and it corrects what I said above about the index files.
Look at the command Nextflow actually ran:
$BWA mem SRR30344499.fasta SRR30344499_R.1P.fastq.gz SRR30344499_R.2P.fastq.gz -t 4 > SRR30344499_R.host.sam
The -t 4 comes after the three positional arguments. On macOS that is the whole problem.
bwa mem parses its options with the system getopt. GNU getopt, on Linux, reorders argv, so an option placed after the positional arguments is still picked up. BSD getopt, which is what macOS uses, does not: it stops at the first non-option argument. So on your Mac, -t and 4 are never parsed as an option at all. They are counted as two extra positional arguments.
bwa mem therefore sees five positional arguments, and the check in fastmap.c is:
if (optind + 1 >= argc || optind + 3 < argc) { ...usage...; return 1; }
More than three positional arguments and it prints its whole options list and exits 1. That is exactly what you got: the usage block, exit status 1, empty stdout. Nothing was cut off when you pasted it either. There is no [E::main_mem] line to find, because bwa never got as far as opening the index.
A one-line check, run from the Work dir: path printed just above the error:
bwa mem -t 4 SRR30344499.fasta SRR30344499_R.1P.fastq.gz SRR30344499_R.2P.fastq.gz > /dev/null
If that runs with the option before the files, while the original ordering prints the usage text, that confirms it.
The same difference explains the other message you saw. sort: invalid option -- '@' is the BSD sort that ships with macOS, which has no -@ flag. You got it because $SAMTOOLS was empty in your own shell, so $SAMTOOLS sort -@ 4 became plain sort -@ 4.
Two ways round it. -t is hardcoded after the inputs in modules/Alignment/bwa.nf, so either run the pipeline in its Docker or Singularity container, where the Linux userland and GNU getopt make the ordering stop mattering, or edit that line so -t ${threads} comes before the reference.
One more thing, and it may matter more than the bug itself. You said you are screening a B. velezensis genome for ARGs. --pipeline rm_host removes host contamination, which is meant for host-associated samples; a bacterial isolate has no host to remove. And the file you are passing as --host, SRR30344499.fasta, looks like it comes from the same accession as your reads, so that step would be aligning your reads against themselves. You can most likely skip host removal altogether and go straight to the resistome pipeline. The --pipeline options are listed in the AMR++ README.