Click Launch Bluetooth Preferences from settings. This will announce to any device nearby that your computer is a bluetooth keyboard.
Now go to the bluetooth settings screen on your phone. And select the Mac Computer from the other devices. If you have previously connected to the mac over bluetooth, click on info and forget the connection to the Mac.
If the phone is able to connect to the Mac you will get a connection dialog. Click on connect. The dialog is different for different types of devices that you connect.
It takes up to 15 seconds to complete the connection after you click connect. Once the connection is complete you will see the keypad dialog. Happy typing.