How OS X Executes Applications
MacHore writes "0xFE has an excellent tutorial on Mach-O, which is the file format used by OS X executable files and libraries. It goes into great detail about how Mach-O works, and explains what OS X actually does when it loads and runs an application. Subtopics include Universal Binaries, The Dynamic Linker, Using otool, and other goodies."
Screw showing how OS X launches applications, I want to see the inner workings of Steve Jobs' pancreas
When FORCE QUIT doesn't work, 120V A/C to the processor does the trick every time.
Universal Binaries, The Dynamic Linker, Using otool? pah!
Never underestimate the power of stupid people in large groups.
I don't have a Mac. Instead, RTFM to learn how Linux executes applications.
Zhrodague.net - I do projects and stuff too.
Mach-O? Further proof that Mac users feel emasculated and need to make up for it. : p
How OS X Executes Applications
Slowly. Call this flamebait, but I have two Macs at home and am always frustrated with the spinning beach ball animation while I wait for my app to launch. The icon bounces, bounces and bounces. I know my 800Mhz iBook with 640Megs RAM isn't the latest/fastest machine, but when I boot back into Ubuntu Dapper it's MUCH faster. I think OS X is a fine OS, but much of what it does in the background isn't helping me check my email, instant message or ssh to remote boxes.
fak3r.com
Do you mean big "O" tool?
Great strides are made weekly on the usability of linux, package management, dependencies, New File Systems, More apps, Wine etc.. and there is no doubt in my mind that they all work towards making Linux easier to use and more accessible to Lambda Joe's.
There is one thing without which no Joe User will go, no matter how pretty or compatible linux becomes: installing Apps.
No matter if you are a Windws, Linux or other die-hard you have to admit Mac OS X Make's it damn easy to instll 99% of the apps. Drag and drop what looks like a single file (in reality a *.app folder) and clik to run.
I immediately knew this was huge when OS X came out and made this possible on *NIX machines, and was secretly hoping that Linux wold catch up with it's own version and take-off.
Unfortunately, we are still relying on the age-old install with dependencies, of-course Synaptic, apt and Yum all make that easier but still too complex for 80% of the people.
When will we get drag and drop app install for Linux?
Artificial intelligence is no match for natural stupidity
yea, you got to love that mach kernel http://sekhon.berkeley.edu/macosx/and how slow it is
With extreme prejudice?
Klik apps for Linux is almost similar to the OS X method. It needs more support from the Linux community. Apt-get and other methods are great, but should really be used for system installs instead of applications. Klik could really help make Linux better.
...then it uses a picture of a round bomb.
Simple.
0xFE has an excellent tutorial on Mach-O, which is the file format used by OS X executable files and libraries. It goes into great detail about how Mach-O works, and explains what OS X actually does when it loads and runs an application. Subtopics include Universal Binaries, The Dynamic Linker, Using otool, and other goodies.
GREAT! Lets tell every wanna-be 1337 h4x0r how to screw with excecutables in OS X only to clog messageboards for help when they screw it up.
On the other hand I guess it does ensure job security for those of us WITH brains.
Offtopic, but can someone tell me how "0xfe.blogspot.com" is a valid domain?
::= <letter> [ [ <ldh-str> ] <let-dig> ]
According to RFC 1034:
<label>
I have some code to fix if "someone@0xfe.blogspot.com" could be a valid address...
Am I the only one to notice that the supposed binary representation of 0xFE on the blogger's page is actually that of 0x7E (ie, it's missing a one)?
Expect an increase of the number of Mac virii out there in a now to 3 month timeframe.
46. The Hobo smiles, his eyes glaze over, and he burps. "Beware the man who has lived longer than the Wasteland."
Mach-o mach-o man,
I want to be a mach-o man!
Why? Are you writing one?
HOWTO_run_mach-O_binaries_on_NetBSD
I'm fairly new to OS X, and don't know much of the internals and I have no clue on developing via Xcode or a lick about Objective-C.
The otool command is new to me. Its handy because I too was getting "No such file or directory" with trying to use ldd. One thing this article does not mention is weather OS X calls mmap() on an executable and/or libraries? It probably does. I believe all modern OSes do this now, but I could be wrong.
Most Macintosh users whether they know it or not are highly bisexual as opposed to the manly Linux and BSD users. Windows users are sexual neuters so this discussion isn't even relevant to them. The only reason they go on and on about "insanely great" thing is because they've been insanely anally violated on an infinite number of occasions not matter what sexual preference their partners had. Case in point. When I was in college I was a Mac user. I thought it was really good (that's before I found the one true saviour: Linux). I was straight, or at least I thought I was. But the more I used the Mac, the more I got curious about the cock. Until I started calling gay chat lines and getting off with dudes! I couldn't believe it. At first I was kind of repulsed after I shot off. But then I started to crave more. But I was still straight because I liked girls too. So, I put up a Bi ad on a phone dating service and someone on campus called me! He wanted to get together and see if we could fit each other's cocks in each other's mouths just as a test. I agreed and I got my first BJ from a dude! It was shocking. Even more shocking was that I had to give him a BJ, but since I already came, I wasn't too interested in doing it. So I just kind of lazily ran my lips along his shaft and gave him a hand job. We saw each other a few times on campus and nervously said hi. But I never got together with him again. So I never told my girlfriend about this because I though she'd dump me. But I soo learned that she wanted to do me with a strap on. I didn't mind because sometimes I could imagine it was the big manly leader of our local BSD user's group. So anyway, I'm straight now because I don't do stuff with guys. And ever since I stopped doing stuff on the Mac, my craving for the cock has disappeared completely. I now let my wife sodomize me with her strap-on (yeah she used to be my girlfriend) but I only think about menly men and not wimpy bisexual Mac users.
That's some funny shit right there, seems Apple built gayness right into the OS.
http://www.albinoblacksheep.com/flash/youare.php
OMFG!
Do they get a cigarette and a blindfold?
"My country, right or wrong; if right, to be kept right; and if wrong, to be set right." --Senator Carl Schurz (1872)
It's kind of cool (in a geeky kind of way) that someone has reversed engineered all of this information. But itsn't it really the vendor's responsibility to document the system and make it available to developers? Alternatively, with open source the source is available to developers who are interested.
I would have thought that how programs are loaded would be well documented by Apple, rather than being some mystery to be decoded.
Windows may suck, but at least the giant sucking sound (tm) is documented.
At the bottom of the article, he gives a bunch of links to the technical documentation from Apple.
Mac OS X ABI Mach-O File Format Reference
Executing Mach-O Files
Overview of Dynamic Libraries
September 2011: Looking for Cocoa/iOS work in Boston area Cocoa Programmer Quincy, MA
Yes I know this goes somewhat against the grain, but try shrinking your swap right down (max 128meg or something)... then, you get OOM messages, at which point you can close/reopen apps, rather than losing control of the system as it grinds to a halt trying to swap constantly.
:-/)
This might not be so important in your (and possible, in most) case[s]. The server's I run I admin remotely. A runaway script can eat through the swap, slowing things to such a halt that logging in, finding the process, and killing it, can become next to impossible.
The smaller the swap, the less time there is before a runaway script (or memory leaking app) will run before the OOM killer gets it.
(I know this isn't really relevant stuff... I'm avoiding doing work
The revolution will not be televised... but it will have a page on Wikipedia
"but I wouldn't point out something in KDE as a problem with OS X as it's not the primary UI"
:-p
not the primary, KDE it's the ONLY UI!
The revolution will not be televised... but it will have a page on Wikipedia
Speaking of which, OS X frameworks are another sterling example of a saner approach. None of this crap where a bunch of files that interact with each other are squirreled around in countless bin/sbin/lib/share/man/etc/include and so forth. All relevant resources in one place. Store it in your .app, or in any Library folder, it just works. Drag and drop.
I only wish that Apple and 3rd party developers were as logical when they put stuff in ~/Library. There's folders for Application Support, Caches, and Preferences: use them.
Well, there are a lot of things *nix could learn from Mac OS X that would make life easier for both users AND developers. But *nix programmers tend to be pretty set in their ways.
---If you can't trust a nerd, who can you trust?
there is a graphical version of otool that is perhaps a bit easier to use. It is called "TimmyOTool" and is located here.
Avoid Missing Ball for High Score
Does this executable format have anything to do with the binaries being able to execute on both ppc and intel machines?
I have a friend who just got a new intel mac laptop. There are a lot of programs which won't run correctly because they don't fully support the intel architecture. However, I know from my linux experience that if I compile something for ppc, and then something for x86, neither executable will even LOAD on the other architecture, let alone execute with any functionality. When I download things for this new mac, I never select anything that is intel specific, and programs like oggdrop and vlc seem to work just fine.
Is this some magic that the program is doing? Or is it on the system level? Or am I missing something obvious about macs?
6th Street Radio @ddombrowsky
Most unixy software (and all software using GNU autotools) all you to configure with --prefix=wherever. This isn't even something special about gentoo, this has just always been possible on every unix.
...isn't this information available when you type "man macho" at the command line?
Momentarily, the need for the construction of new light will no longer exist.
man Mach-O
one of the two (usu. the newest and bestest) might not be able to install because of unsolvable dependances, the other is ten years behind in features or usability from what is available in the commercial world..
How bloated must that be?
Seriously, how many copies of a library does that leave you having installed?
Generally? One.
Remember, this isn't a Linux distro, where the user has all the choices in the world except the one that matters most: the choice to have all of their apps look and behave in a consistent manner. 99.99999% of all apps targeting OS X link against the standard system Carbon or Cocoa frameworks. The odd app might have a really large third party library linked in and included in the app bundle, but that tends to be the exception rather than the rule, as the bundled libraries tend to be of the small, utility type that only run a few K. How bloated is it? Not very at all.
Now compare that with the situation on your average Linux distro: Instead of one version of one or two frameworks, every third app is written against a different toolkit. Want GIMP? Install GTK. KDevelop? Need QT too. Your text editor links against the athena toolkit, your system management utilities against Tk, your games against SDL, your audio editor against WxWidgets, your file manager against GNOME, something else against FLTK, FOX, Lesstif, Xaw...your shared libraries folder reads like an explosion at the acronym factory. Repeat ad naseum for your XML parsing libraries, your regex libraries, your sound libraries, etc, etc.
And it doesn't end there. Binary compatibility between library releases is the exception rather than the rule. Every third GTK app requires that a different point revision of the GTK libraries be installed. XMMS requires that you install libraries that are several major revisions out of date. You've got 6 different versions of three different XML parsing libraries installed, 2 regex engines, 3 copies of your JPEG, PNG, etc libraries, 3 or 4 different audio libraries with a couple different versions installed. Multiple versions of multiple libraries; an endless proliferation of crap that all does the same job with only the most miniscule of differences. All for the sake of an illusion of "choice" foisted on the end user by a fractious developer base with a raging case of Not Invented Here Syndrome and a belief that their convenience is more important than a consistent experience for the end user.
Now, how bloated must that be?
Despite all the boring back-and-forth between the supporters and detractors of defining a new plural word meaning computer virii (as opposed to biological viruses) you have just made the first intelligent comment that wasn't annoyingly longwinded pedantry.
And furthermore.... oh, shit!
If you have access to an OS X install disc than you have access to this information. The optional developer tools contain a wealth of information, as well as tutorials, and come free with the os (and by extension, with every Mac sold since Apple switched to OS X).
Boundless Expansion, Self-Transformation, Dynamic Optimism, Intelligent Technology, Spontaneous Order- BEST DO IT SO!
Beautifully!
Humm, next time I'm looking for a project I'll have to give installing WindowMaker a shot.
I knew that KDE wasn't exactly renowned for being lightweight or speedy, but I'm glad to hear somebody else agree that the hardware I'm running it on shouldn't be that underpowered for it, because I didn't think so either. I'm willing to cut it a little slack too because it's KDE 3.5.0, so hopefully it will improve in time, but I was still stunned by the lack of performance. (Konqueror also SIGSEVs repeatably when I try to use the "File Image View" on my home directory, and I can't figure out why...one of many quirks that system seems to have developed.)
I would consider using Gnome, but the lack of a screen-top, context-sensitive menubar is a deal-breaker for me. Is using the full-blown KDE window manager the only way to get this? Linux window managers are relatively new in my life; the majority of my Linux use in the past has been through shell sessions, this is really my first attempt at giving it (what I thought was) a fair shot as a desktop system. If I can get a desktop that has a top-of-screen menubar, without the load of KDE, I'm really not wed to it in any way.
"Ladies and gentlemen, my killbot features Lotus Notes and a machine gun. It is the finest available."
You mean, there are millions of Mac users? Gee, who knew?
(I kid, I kid...)
Read the best of all of Slash: seenonslash.com
That's exactly what I meant. The problem is figuring out which processor pins to wire to 120V and which to ground.
Mea culpa for saying A/C. Some days I ask myself watts the matter with my keyboard.
-Anonymous/Coward
Apple have a "Mac OS X Software..." menu option in the Apple Menu, which takes you to this page:
http://www.apple.com/macosx/get
No need for stumbling onto Version Tracker.