1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

.command files

Discussion in 'Mac Programming' started by Muncher, Nov 29, 2007.

  1. macrumors 65816


    Simply put, what the hell are .command files? I've only seen them once.

    They are binary executable files. Finder says they're associated with terminal. When I looked for them online, I got nothing. Does anyone know what these are?
  2. macrumors 6502a


    What in particular are you looking for?

    I check the web site, but I don't recognize it and I don't care to run the video there.
  3. macrumors 65816


    You don't have to run the video, just download it. It's 4k - seriously, dude! It won't take a minute even on dial up. :rolleyes:

    I just want to know: a) what kind of file it is, and b) how to make one myself. I can find out the second part, I just need part a first.
  4. macrumors 6502a


    No thanks - anyone else?

    Edit: maybe someone on that site can assist you
  5. macrumors 68020


    Pretty sure that's just an explicit way of associating a shell script with Terminal.app in the Finder. If you look at the contents of that file, you'll see that although the majority of it is a binary application, the first six lines are a shell script that extracts that binary content to a file in /tmp, runs it and then deletes it.

    Not that I'm going to run it. Video was coolish, I guess.
  6. macrumors 68020


    Yup, .command is meant to be used as shell scripts/etc for the Terminal. You can actually make unix binaries into .command files and it should run just fine.
  7. macrumors 68020


    The period at the beginning of the file name just makes it a hidden file to normal terminal directory listings. Probably in Finder as well.
  8. macrumors 68020


    The files don't start with period, it is a file extension. The files in quesion would be like:


    The .command file could be a bash script, a perl script, an executable file, pretty much anything you can correctly execute using the exec command or calling it directly.
  9. macrumors 65816


    Funny, I was just talking about .command files with someone at work today. I use them all the time when working on projects that require several files. You can write a .command file that, say, opens up the terminal, launches three documents and two apps, then closes the terminal, all activated just by double clicking on an icon.

Share This Page