There’s no difference between CGColorSpaceCreateWithName (kCGColorSpaceSRGB) or rgbColourSpace, in both cases CGColorSpaceGetNumberOfComponents(colourSpace) returns 3 in createGradient().
This failed for me as well in OS X 10.13.6 on a 27" imac from 2011. So, a normal imac, not a retina display or anything.
Can you explain this? I would really like to get matching gradients between what I’ve sketched out in an SVG editor and what I see in JUCE, and have no idea how to match them without using JUCE_LIVE_CONSTANT for the R, G, and B values while using Digital Color Meter to see what value I’m actually getting.