Advantage.
Once farming showed it was at an advantage it spread.
Having said that nomadic lifestyles still exist for instance there is about half a million nomadic pastoralists in Tibet alone.
Advantages where they exist spread quickly. So where farming gave an advantage is generally when there is consistent seasons and a semi-harsh environment meaning that farming is a safer option then nomadic lifestyle.
Bookmarks