The measure, which passed by the City Council on Tuesday, will be in effect for three months, the San Jose (Calif.) Mercury News reported.
"It's not my intention to go out and commit a pig genocide," said Councilman Johnny Khamis. "I'm only here to make sure the public is not harmed by these very bold group of animals."
After the measure expires, council members will discuss a long-term shooting law next year.
Council members say the pigs -- which weigh about 200 pounds -- have created a crisis in their city and have caused thousands of dollars in damage to businesses and homeowners by digging in lawns.
"What we're talking about are not the 'Three Little Pigs,' like 'Babe' or [cartoon characters] you see on TV. They're not cute and cuddly," said Councilman Pete Constant. "There are people who are genuinely scared, and I'm glad they're not comfortable going up trying to pet them."