How can I automatically tether on Macbook when I don't have wifi?
The priority given by your Mac to the various connections are determined by the order of services listed in your Network settings. To view this:


Go to System Preferences > Network:




So the best way to achieve what you want is to use a USB connection for your iPhone tethering and then change the order as follows:


Click on the Cog/Gear icon (on the right of the minus '-' sign at bottom left)
Select Set Service Order...
In the Service Order window that appears, click and drag the Wi-Fi connection so it is at the top and then move your iPhone USB connection so that it’s second)
Click OK
Exit System Preferences


Now, if your Mac has no Wi-Fi connection it’ll go to the next one in your Service order to see if that’s available and so on.

Note: You don’t have to use a USB connection for your iPhone tethering, however I recommend this as it has the extra benefits of keeping your iPhone charged and ensures a stable connection.