The show was almost canceled during the first season of shooting. The President of the FX Network wanted to add a new character and he was friends with Danny DeVito, so he decided to approach him to ask about joining. DeVito's children were big fans of the first season of the show so he decided to sign on for ten episodes. DeVito enjoyed being part of the show so much he became a regular member of the cast.
During a convention interview, star Glenn Howerton was asked why his character was named Dennis, whereas Charlie Day and Rob McElhenney's characters are named after themselves. Howerton responded by saying that he wanted to distance himself from his character as much as possible.
Since Danny DeVito was only available for 20 days for shooting during season 2, the production crew had to work on all 10 episodes of the season at once, often shooting scenes from multiple episodes in one day.
The pilot was created by four Hollywood actors (Rob McElhenney, Glenn Howerton, Charlie Day and Jordan Reid) about struggling as actors in LA. The show was initially titled, "It's Always Sunny on TV". The original, unaired pilot only cost $200 to make and was shot on a digital camera, with the actors taking turns holding the boom. It was then shopped around to different networks and was picked up by FX. They then moved the setting of the show from LA to Philadelphia and re-shot the pilot.
Despite the reports that the show's pilot was shot for $200, it has actually been revealed that the pilot may have cost as little as $85 to shoot. The budget went almost solely to tapes for the camera.
In June 2011 it was reported that Rob McElhenney had gained 50 pounds in the previous six months. McElhenney has stated that he noticed characters from other sitcoms get better looking as the series progress (because the budgets get bigger, and that means more and better makeup people), but McElhenny wanted his character to do the opposite. Co-star Glenn Howerton started referring to the character Mac as "Fat Mac." When McElhenney asked if he could be called "Big Mac," Howerton said he would call him "Big, fat Mac."
According to creator Rob McElhenney, the name "Sweet Dee" was the nickname of one of his friend's girlfriends. He liked the nickname and later thought of it while creating the character of Dennis' sister.
Season 6 included an episode titled "The Gang Gets Successful" that was never aired on FX. In Season 7, some of that footage was used for the episode It's Always Sunny in Philadelphia: How Mac Got Fat (2011). In addition to showing Rob McElhenney before his 50-pound weight gain, the story explained that the Gang had a Dee-conceived plan to hire individuals who looked like them as "avatars" so they could enjoy their newfound good fortune, but Mac's efforts to emulate his bodybuilder avatar went disastrously awry (and everyone else forgot the plan about 10 minutes after it was proposed).
In an interview, star Kaitlin Olson said she broke her back during an accident in the summer of 2008. She was still recovering during the shooting of season 4, which caused an episode where Sweet Dee falls down a flight of stairs to be pushed back to season 5. Olson said she felt it wasn't a smart idea to do the stunt while recovering from a broken back.
Each episode ends with the RCG production logo, with the actors in hoodies with a sound clip played backwards: "for playing this forward." At the end of the first-season finale "Charlie Gets Molested", the message had an echo: "Is it brown? Is it brown? Good work. Is it brown? Is it brown? Is it brown? Good work."
The Philadelphia landmarks seen in the series' opening credits montage are the Benjamin Franklin Bridge, Penn's Landing on Market Street, Lincoln Financial Field, Swann Memorial Fountain in Logan Circle, Boathouse Row, 30th Street Station, and South Street Philadelphia.