The spell that Sethai mentions is called 'erosion', which is a level 3 spell. In order for the harbour to be built, the harbour needs to connect between the city and water so there needs to be one tile (or slightly less) between the city and the water. If the tile is not a sandy beach but a cliff, the erosion spell will turn the cliff into beach. Building a harbour is a little quirky so ypu need to be careful about placement and make sure the harbour icon is aligned properly before you right click to set it down. I find that this is easier if you use the erosion spell twice, one on each adjacent tile. I would recommend that you also download the 'Fish Market" mod which will give you a valuable food resource even if the city doesn't have a farm. Let me know how you make out.
Yes, it can be very tricking determining if the town and beach are in the correct orientation in order to build the harbor.
I've had cities that looked like they were adjacent to a beach tile and the game would not allow me to build a harbor, while another city that was next to a very small lake (more like a pool) was able to build one.
I have tried at least one fishing as a food resource mod and could never get it to work.
Does the Fish Market mod give you any feedback to let you know it is working?