Inline Shader code will not run

The following Processing code using inline shaders will not run on a Mac due to this error:

ERROR: 0:6: 'attribute' : syntax error: syntax error

The same code using separate .glsl files in the sketch folder runs ok. The only difference is that the frag.glsl and vert.glsl files neither one have the #version line of code. If I try putting the #version line in the separate files I get the attribute error as shown above. In contradistinction, the inline shader code shown here will throw an error message if you leave the #version line out; it has to be there for inline code. The ‘attribute’ syntax causes no problem in a separate vert.glsl file, but throws an error with inline shader code for reasons I do not understand. Macs supposedly support #version 410 (I also tried 330 with same result).

PShape sh;
PShader shader;

void setup() {
  size(300, 300, P3D);
  strokeWeight(30.00);
  sh = createShape();
  sh.beginShape(POINTS);
  sh.vertex(120, 80, 0);
  sh.endShape(CLOSE);
  shader = new PShader(g.parent, vertSrc, fragSrc);
  println(g.parent);
}

void draw() {
  shader(shader); 
  shape(sh);
}

String[] vertSrc = {"""
#version 410
uniform mat4 projection;
uniform mat4 modelview;

attribute vec4 position;
attribute vec4 color;
attribute vec2 offset;

void main() {
  vec4 pos = modelview * position;
  vec4 clip = projection * pos;  
  gl_Position = clip + projection * vec4(offset, 0, 0);
} 
"""};

String[] fragSrc = {"""
#version 410
out vec4 outColor;
void main() {
  outColor = vec4(0.0, 0.0, 1.0, 1.0);
}
"""};

Change attribute to in:

in vec4 position;

and likewise, varying is replaced with out.

Works like a charm; thanks.