The move will likely give the former Tesco and Sainsbury's executive the chance to steer Brakes on to the stock market.
Mr McMeikan said: "It has been a great honour to lead Greggs since 2008.
"There are many exciting growth opportunities ahead for the business and the team are well placed to deliver them."
Derek Netherton, chairman of Greggs, said: "We are very grateful to Ken for the valuable contribution he has made to Greggs. He has led the company through the major changes that have put us in a strong position for the future with a clear strategy for growth in a difficult environment."
Greggs has more than 230 outlets in Scotland, employing 2800 people, and has been a focus of Mr Meikan's expansion drive at the Newcastle-based company, which has also increased its presence in the south of England.
Since taking over in 2008, Mr McMeikan has also overseen a centralisation of production.
Greggs, with the help of a 300,000-name petition from customers, led the campaign to reverse the imposition of VAT on warmed-up pasties and sausage rolls, which was announced in the March Budget and ditched in May. Mr McMeikan, who is from Stranraer, delivered the petition to Downing Street.
Brakes has annual sales of more than £2.8 billion, around four times that of Greggs, and supplies restaurants, pubs and hotels in the UK, Ireland, France and Sweden. It was bought by US private equity group Bain for £1.3bn in 2007.
A flotation of the business could prove highly lucrative for Mr McMeikan if it is accompanied by the share-option plans which are typically offered to senior management on such occasions.
Mr McMeikan joined the Royal Navy at 16 and served during the Falklands War. On leaving the service at 21, he became a warehouse operative for the British Shoe Company, part of Sears.
His swift ascent up the corporate ladder saw him going on to the Freeman Hardy Willis store in Oxford Street, then take over the company's manager training programme.
He moved to Tesco in 1990, where he worked for 14 years until Sainsbury's poached him and he became its retail director.
As a result of Mr McMeikan's departure, Shore Capital downgraded Greggs from "buy" to "hold".
Analyst Clive Black said: "We cannot hide our disappointment for Greggs' shareholders on the announcement of Mr. McMeikan's resignation."
Sanjay Vidyarthi, analyst at Espirito Santo, said: "Under McMeikan, Greggs developed from a group of semi-autonomous regional businesses to a more cohesive and efficient national chain, while retaining its local character.
"Greggs is at a difficult point in its evolution at the moment, with pressure on trading and decisions to be made on how best to allocate capital (store refits or roll-out).
"The timing of this departure is therefore unhelpful, though there is a strong and exper-ienced management team underneath."
Following the announcement of his departure, shares in Greggs, which is Britain's largest seller of food on the go, fell 14p or 2.9% to close at 472.5p.