The iPhone comes with a feature that enables it to share its 3G or 4G mobile broadband connection with other devices (though this must be allowed by your network operator), making it perfect for getting your Mac online wherever you are.
There are three ways to connect your Mac to your iPhone to share its signal: Wi-Fi, Bluetooth, and USB.
To begin, go to the Personal Hotspot option in the iPhone's Settings menu, and turn it on. If you want to connect over Wi-Fi, find the Wi-Fi network created by the iPhone in your Mac's Wi-Fi options, select it, and enter the password shown in the iPhone.
To connect using USB, plug your iPhone into your Mac and you should get a dialog that takes you to the Network section in System Preferences, from which you can select the iPhone.
To begin, go to the Personal Hotspot option in the iPhone's Settings menu, and turn it on. If you want to connect over Wi-Fi, find the Wi-Fi network created by the iPhone in your Mac's Wi-Fi options, select it, and enter the password shown in the iPhone.
To connect using USB, plug your iPhone into your Mac and you should get a dialog that takes you to the Network section in System Preferences, from which you can select the iPhone.
For Bluetooth, activate Bluetooth on both devices and pair them, and the connection option should again appear in System Preferences > Network.