Hi,
Eric has it.
However in pedantic detail.
On the iPhone > Settings > Messages
The iPhone Number needs to be used for iMessages (turn the App On)
Then the Mac needs the same (using the Apple ID) in the iMessages account.
Then you link the two by adding the Apple ID to the iPhone And accepting the resultant Pop up on the Mac about what the iPhone is Using (Adds the iPhone number to the Mac version settings).
At this point you set the Text Forwarding n the iPhone in the Settings > Messages.
This causes the pop up to appear on the Mac.
The Code in the pop up has to be entered on the iPhone in the dialogue box that should still be open.
8:55 pm Thursday; March 5, 2015
iMac 2.5Ghz i5 2011 (Mavericks 10.9)
G4/1GhzDual MDD (Leopard 10.5.8)
MacBookPro 2Gb (Snow Leopard 10.6.8)
Mac OS X (10.6.8),
Couple of iPhones and an iPad