If you are going downtown, take the BART. It costs about USD $9 to take from the airport, runs frequently, picks up inside the airport, and takes you straight in to downtown.
However, the ideal transportation if you're visiting is to simply walk around. It's amazing how easy it is to walk everywhere in SF.
For Alcatraz, just grab a lyft/uber to the pier and take the ferry. By the way, if you have time the longer, late evening tours are quite interesting.
And also sold out months in advance.