Systems and methods for attaching a reference marker to a patient in a computer-assisted image -guided surgery system. An apparatus for attaching a reference marker to a patient includes an elongated member extending between a first end and a second end, a sharp tip located proximate to the first end of the elongated member that is configured to break through a cortical surface of a bone of the patient to enable the elongated member to be advanced into the bone, an anchoring device that is extendable from the elongated member in order to anchor the apparatus within the bone and inhibit relative movement of the apparatus and the bone, and a reference marker device comprising at least one optical marker configured to enable the apparatus to be tracked using a motion tracking system.