How do I build a courthouse in a captured city?
I captured an enemy city, and my advisors informed me that the city will produce a lot of unhappiness until I build a courthouse there. However, the production in the city is 0, so no actual progress is being made. I don't have the option to buy the Courthouse either (all options under Purchase are grayed out, despite having more than enough gold).
So how am I supposed to build a courthouse?
Solution 1:
After capturing a city, there are several turns of no production.
If you created the city as a puppet, you don't have any say on what the city builds, but it produces less unhappiness than an annexed city.
If you annexed the city, you should be able to choose to produce a courthouse (given that it has been researched and is not already built in the city), but this will of course only happen after the period of no production following the cities' capture.
Solution 2:
In general, it seems to be better to start by making a newly captured city a puppet. The attack significantly lowers the population of the city, making it very hard for it to produce anything. If you give the city a while to get through the rioting mentioned in other answers, and then allow its population to grow for a while, it will be much easier to build the courthouse. When you do annex the city, make sure to change it to start building the courthouse right away, and set it to maximize production in your civilian allocation. If you can wait to annex the city until you are in a golden age, that will greatly improve the speed with which you can build the courthouse.
Solution 3:
Immediately after annexing a city the city is in resistance. This means that there is no production output and you can't buy anything. You can see how much longer the city is in resistance by hovering your mouse over the small red fist directly below the city's label:
Once the resistance has stopped the city will still add extra unhappiness to your empire as long as it does not have a courthouse. This is displayed by the chain symbol below the city label. Depending on how much production output your new city has it might be a good idea to buy a courthouse instead of waiting for it to be produced. You can buy it as soon as the resistance has stopped to prevent your newly acquired city from creating too much unhappiness.