NEAR the massive packing warehouse at the headquarters of Limoneira, one of America’s largest lemon producers, sits a row of small white clapboard houses with neat front lawns and American flags flapping over their doorways. The homes are rented to farm workers at 55% below the market rate in Santa Paula, California, a fertile farming area not far from the seaside homes of Malibu. From their front doors, workers can stroll to a bocce court, a credit union and a park where family reunions and birthdays are celebrated. These perks, along with competitive pay, used to be enough to keep Limoneira’s fields of lemons and avocados full of workers. Not any more, says Alex Teague, the company’s senior vice-president. Though labour has long been tight, “I have never seen it this bad,” Mr Teague sighs from a chair in his office whose walls are covered in company memorabilia, including Limoneira’s first cheque from 1893.

Across America, farms are experiencing similar troubles. In May Tom Nassif, the president of Western Growers, a farming association representing family farmers in Arizona, California, Colorado and New Mexico, travelled to Washington, DC, with 25 farm-owners. When Senator Dianne Feinstein of California asked how many were experiencing labour shortages, they all raised their hands. Although official data from the Department of Agriculture show a slight fall in the number of farm workers between 2000 and 2012, the New American Economy (NEA), a group which advocates immigration reform, reckons that on a more realistic count, from 2002 to 2014 the workforce actually shrank by 20%. Bob Young, the chief economist for the American Farm Bureau Federation, a lobby group, thinks official numbers underestimate the extent of the shortfall since they ask how many workers a farmer has, not how many he wanted but could not find.

Farms are feeling this effect. According to the NEA, the farm-labour shortage accounted for $3bn in lost annual revenue between 2002 and 2014. Partly because production cannot keep up with demand, Americans are eating a lot more imported food (an increased appetite for fruit and vegetables plays a big part, too). Between 1998 and 2012, the share of America’s fresh produce that was imported increased by 80%; the NEA attributes a chunk of the decrease in American farmers’ share of the domestic produce market to the labour shortage.

California, which produces a third of America’s vegetables and two-thirds of its fruits and nuts, has been particularly affected. The Farm Labour Survey and US Census of Agriculture record that the state lost nearly 40% of its agricultural workforce between 2002 and 2014. According to the Grower-Shipper Association of Santa Barbara and San Luis Obispo Counties, $13m-worth of fruit and vegetables had to be ploughed under in 2015 because of the lack of pickers—up from $11m in 2014. At Limoneira, overripe lemons litter the ground under the trees. Farmers blame the labour shortage on a variety of factors. Fewer Mexicans are coming north to America, the result of a combination of improved border security, an increasingly robust economy in Mexico and a lower birth rate. Analysis by the Pew Research Centre in 2015 found that net migration to America from Mexico was 2.3m between 1995 and 2000. Between 2005 and 2014, more Mexicans left America than arrived. Such dynamics have been tough for farmers. According to the most recent data from the Department of Labour, 70% of farm workers are Mexican; in California that number is closer to 90%. A generally tight labour market does not help either. Harvesting is gruelling work, says Stewart Lockwood, the director of field operations at Limoneira, as he walks through one of the company’s lemon groves. With the Californian sun beating down on them, labourers crouch to pluck lemons off low branches and strain to grab them from high ones, carefully placing the fruit in satchels that weigh 65lb (30kg) when full. With a state unemployment rate of 4.5%, manual labourers can afford to be choosy. “If these guys can get a job in construction, they might do that instead,” Mr Lockwood says. Farmers have responded to the labour shortage in three main ways. The first is by paying better. Since 2000, the average hourly wage of crop workers has risen from $8 to $12. In California it has jumped even more, from about $7 in 2000 to $13 today. At Limoneira, workers are paid an average of about $19 an hour—which is 30-35% higher than three or four years ago, says Mr Teague. Still, his workers sometimes get poached by nearby farmers willing to pay more so that their fruit and vegetables do not rot in the field.

Another response to the shortage is to hire workers through the H-2A visa programme. Since 1986, the H-2A programme has allowed farmers struggling to find labour to hire foreign guest-workers temporarily. It is cumbersome to apply for and expensive: farmers must provide H-2A workers with free housing, food and transport to work. Even so, 134,000 H-2A visas were granted nationally in 2016, up from 55,000 in 2011. (Despite the president’s directive to companies to “hire American”, Eric Trump, the president’s second son, has requested 29 H-2A workers to prune vines at the family’s winery in Charlottesville, Virginia, since December 2016.)

Limoneira’s adjustment has been smoother than most. The company already owned a huddle of trailers that dates back to the bracero programme, when Mexican farmworkers came north across the border to replace Americans fighting in the second world war. These have been refurbished to house migrant workers. Other companies have rented, bought or even developed property to house workers. Bonipak, a company based in Santa Maria, bought and renovated an old motel to house farm labourers, spending more than $1m to bring the building up to H-2A standards. A couple who owned a strawberry farm in Nipomo built a series of houses for H-2A workers in 2016, only for arsonists to burn one down in protest.

Farmers are considering ways to substitute machines for human hands, too. Machinery is already used to shake almonds from trees and pluck tomatoes from their stalks. Vineyards are using more machines to pick their grapes, a process which once seemed too fiddly to be mechanised. Squishy crops that grow close to the ground, such as strawberries, will be the last to go. Many machines do still require humans to operate them. But farmers believe it is only a matter of time until the harvesting of most crops is automated.