Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Muncher

macrumors 65816
Original poster
Apr 19, 2007
1,465
0
California
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?
 

Muncher

macrumors 65816
Original poster
Apr 19, 2007
1,465
0
California
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.
 

Gelfin

macrumors 68020
Sep 18, 2001
2,165
5
Denver, CO
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.
 

Krevnik

macrumors 601
Sep 8, 2003
4,100
1,309
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.
 

pilotError

macrumors 68020
Apr 12, 2006
2,237
4
Long Island
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.
 

Krevnik

macrumors 601
Sep 8, 2003
4,100
1,309
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.

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

MyScript.command

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.
 

telecomm

macrumors 65816
Nov 30, 2003
1,387
28
Rome
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.