1. Couchsurfing. Travelers and hosts are everywhere and many of them love to share their experiences. I messaged different people whether they're up for a coffee/ beer and met their friends. It didn't take long until I was part of their social circle and met amazing people.
2. User groups. I've been a Python developer for a long time and in the bigger cities there is almost always a user group - even if it's just students looking for help with their exam preparation.
3. Sports. I don't have to mention how important it is to stay healthy and fit. So I checked out a local boxing club. Enjoying sports (IMO especially contact sports) with others creates some special kind of friendship.
All of these points (plus the obvious social interactions with coworkers) helped me a lot to get set in this city, but also find travel partners and improve my Spanish. All you have to do is bring yourself to go out and talk to as many people as you can. After all, they're all different and you never know what you get.
What sort of worked for me the most so far, are various "international" meet-ups/communities, like Couchsurfing (they now have this feature called "Hangouts" where you could hang out with locals and travelers in real life) but those of course are a bit farther from "locals" and more into expat/traveller scenes.
Also, I believe, going to bars works as well. But you need some calm, cozy and compact places (not the crazy/party ones). Craft beer places work good in my experience also some "artsy" venues.
Friends as in people you hang out with during your down time? That's beyond me. I'm afraid. I only manage to befriend old people.
2) Sports. Rec league. Just sign-up and play. You get to meet random people if you never pick your team and just get assigned. After a season or two you'll know who you want to play with. Organized play can be better than pick-up games (depending on where you are) because you'll see the same people regularly and have a chance to actually get to know them. Invite them, or accept their invitations, for food or drinks after the game.
3) Church. Unless you're vehemently atheist or have some other fundamental issue with the churches available in your area. Stick around after service, enjoy coffee and donuts, they usually have social and outreach organizations. You don't have to be religious, though you may get pestered about why you don't go to the Bible study, easy to deflect (IME).
4) Bars. Someone else said this. One thing to avoid, if you're feeling particularly lonely/depressed, don't do this. But otherwise, if you can find a nice small bar (not a sports bar, they tend to be too noisy), and sit at the bar. Get to know the bartender, talk to them, there will be other regulars. It's kind of fun too, you may not make as many friends, but I met a guy that was visiting here studying Native American tribes (archeology) from Oxford. Cool random conversations you can have sometimes.
5) Invite people to things. One thing to realize about life, at some point you have to take charge or things won't happen. If you find yourself not being invited to movies, sports, trivia, parties, potlucks, whatever, do the inviting. Get a small group, encourage them to invite their friends. Keep doing this. You can control who you invite so after a while you can focus on the ones that you're actually becoming friends with.
You can also go to meetup.com and find stuff you're interested in.
Bars are fun, I guess, but usually people go with groups so meehhhhh.
2. Participate in recreational activities suited for small groups, such as dance, rafting, backpacking
3. Join a local hackerspace
4. Practice the art of disinhibition