my mac kept getting stuck on the apple logo when booting up so I went into recovery mode and formatted the disk and installed OS X again. But for some reason it is not booting normally when I switch it on it boots automatically into disk utilities??
When you say "boots automatically into disk utilities" do you see this screen?
If so, try closing the window by either pressing the Command and Q keys simultaneously or by clicking the red button in the top left corner of the window. It should prompt you to either shut down, restart, or select a startup disk. Choose to select a startup disk, then chose "Macintosh HD" (unless when you erased your disk and installed OS X again you replaced Macintosh HD with another name, in which case you should select that disk instead). Then click "Restart".