If you live in a condo complex or apartment building, most likely the management would not be too fond of you installing a pull-up bar outside hanging from any of its structures. 

So I hung it from the beams of the second floor patio and put it right up against the beams so that it would not hang down and be noticed. Your head will go right in between the rafters so it works great. 

Use a 4 foot long 1 inch in diameter plumbing pipe. Attach it to the rafters with 3/4” plumbers strap, which you can get at Home Depot. Screw into rafters with #8 2” drywall screws. Wrap the plumbers strap around the bar and pull it tight to get bar snug against the beams. Attach on both sides with two screws.