 <p>The code I had to add to my view controller, after applying the constraints as per the ilya’s answer:</p> <p>In <code>controlTextDidChange</code> (<code>_controlWidthConstraint</code> refers to the fixed width constraint of the input; it’s probably 0 by default for the second input):</p> <pre><code>// Get the new width that fits float oldWidth = textControl.frame.size.width; [input sizeToFit]; float controlWidth = textControl.frame.size.width; // Don’t let the sizeToFit method modify the frame though NSRect controlRect = textControl.frame; controlRect.size.width = oldWidth; textControl.frame = controlRect; _controlWidthConstraint.constant = controlWidth; </code></pre>