UPS spokesman Steve Gaut told The Associated Press an employee fired inside the facility before the drivers were sent out to do their normal daily deliveries.
San Francisco Assistant Police Chief Toney Chaplin told reporters that officers found wounded victims and brought them to safety. When they found the gunman, he put the assault pistol to his head and shot himself. He has not been identified, nor is his motive known.
Auto shop owner Robert Kim said he heard about five to eight rapid gunshots. The next thing he knew, he said, "a mob of UPS drivers" was running down the street screaming "shooter, shooter."
Raymond Deng, 30, a data scientist for a start-up company who lives across the street from the facility, said he looked out his apartment window to see a group of UPS workers fleeing the building and shouting. He says another group of about 10 workers assembled on the roof and held their hands up as police began to arrive.
Deng says he "saw police officers go up from the ramp and then storm the buildings."
The shooting took place at a UPS facility in the Potrero Hill neighborhood, about two and a half miles from downtown San Francisco.
Uniformed UPS employees were later led out in a line by officers next to a highway. They walked away calmly with emergency vehicles nearby and gathered nearby outside a restaurant.
The shooting led to a massive police response and a shelter-in-place warning for the surrounding area.
It came the same day a gunman opened fire on Republican lawmakers at a congressional baseball practice, wounding U.S. Rep. Steve Scalise of Louisiana and several others.