Inflows of foreign knowledge are the key for developing countries to catch up with the world technology frontier. In this paper, I construct a simple tractable model to analyze (a) the incentives of foreign firms to bring their know-how to a developing country and (b) the incentives of domestic firms to invest in their own know-how, given the exposure to foreign ideas and competition. The model embeds two diffusion mechanisms typically considered separately in the literature: externalities and markets. The dynamic gains of openness can be substantial under either mechanism, but their relative preponderance significantly changes the dynamic implications of openness. Notably, openness allows developing countries to fully catch up only when market transactions fully dominate the diffusion of ideas. While externalities can also push domestic firms to upgrade their productivity, the equilibrium exposure to ideas in the country remains below the frontier and domestic firms never catch up.