How to make a standalone colorbar

I need to make several figures and then splice them together at the end. I am trying to make a colorbar by itself to add to the final figure. Here is my attempt:

gmt begin fig png 
  gmt makecpt -D -Cjet -T-1.5/1.5 > t.cpt
  gmt colorbar -Rd -Ct.cpt -DJBC+w6i/0.5c -Bx0.75 -By+l"nT/kA" -Y0.1c
gmt end

However, I get this error:

psconvert [ERROR]: Unable to decode BoundingBox file /home/user/.gmt/sessions/gmt_session.26811/ (maybe no non-white features were plotted?)

If I use the above commands with plotting maps, it works ok, but not by itself. Any ideas?

Do you mean -H?

Or get rid of that > t.cpt (which would require -H, but why try to mix classic and modern mode?) and also the mention of t.cpt elsewhere.

Ok I removed the > t.cpt and -Ct.cpt, but I get the same error as before

Says you have not plotted anything

This works for me.

  gmt makecpt -D -Cjet -T-1.5/1.5 > t.cpt
  gmt colorbar -Ct.cpt -Dx0/0+w6i/0.5c -Bx0.75 -By+l"nT/kA" -Y0.1c -png fig

If you use -DJBC then how will GMT know where that is without a -R and -J? Also, colorbar does not take -R.