Take the 2-minute tour ×

Since I started learning Objective C and Cocoa, I've been wondering why they have chosen the extension .m for the implementation files - was it supposed to mean something, or was it just a random letter? Does anyone know? I couldn't find such information anywhere on Google...

share|improve this question
It's for the *em*plementation. –  dreamlax Mar 16 '09 at 21:36
I guess this was bothering someone else, so they did a bit of research finding contradicting evidence on the meaning behind .m extension. Ultimately it stands for messages. For the full read: pempek.net/blog/2013/11/30/objective-c-file-extension/… –  John Riselvato Dec 6 '13 at 16:17
add comment

4 Answers

up vote 189 down vote accepted

Today most people would refer to them as "method files", but

"The .m extension originally stood for "*m*essages" when Objective-C was first introduced, referring to a central feature of Objective-C [...]"

(from the book "Learn Objective-C on the Mac" by Mark Dalrymple and Scott Knaster, page 9)

EDIT: To satisfy an itch I emailed Brad Cox, the inventor of Objective-C, about the question and he answered with this single line:

"Because .o and .c were taken. Simple as that."

Here's the email as visual prove:

enter image description here

share|improve this answer
Nice inquiry, thanks for sharing. –  ybakos Dec 8 '11 at 16:34
You bothered to email Brad Cox to find out! You awesome, awesome person. –  Chironex Dec 16 '12 at 14:21
Sounds like he was making a joke. If o and c were taken, why m and not any other available letter ? While I think it's a funny reply, I also find it hard to believe it was simply pulled from a hat and he didn't use any logic in choosing m. –  prototypical Dec 28 '12 at 15:48
I agree he was likely joking, but likely somewhat tongue in cheek. .m likely was for method or messaging, but also only used because .o and .c were already used. –  bigtunacan Feb 2 '13 at 18:08
I wish Brad had actually answered the question instead of just explaining why .o and .c were not used. At least it does shed a tiny bit of light on one aspect of the answer though... –  INTPnerd Jun 10 '13 at 23:09
show 1 more comment

From the first Google result (Wikipedia entry) for "objective c" file extension:

The interface only declares the class interface and not the methods themselves; the actual code is written in the implementation. Implementation (method) files normally have the file extension .m.

share|improve this answer
add comment

.m files contain the (m)ethods. Possible reason?

share|improve this answer
add comment

It stands for "methods". From the comp.lang.objective-C FAQ:

The organisation of Objective-C source is typically similar to that of C or C++ source code, with declarations and object interfaces going into header files named with a .h extension, and definitions and object implementations going in files named with a .m (short for methods) extension.

share|improve this answer
add comment

Your Answer


