command-line use on OS X

Alex Rice alrice at arcplanning.com
Tue Aug 26 17:57:01 EDT 2003


On Tuesday, August 26, 2003, at 03:58  PM, Dar Scott wrote:

> I downloaded the Darwin engine and I can do this:
>
> ./mc helloworld.txt
>
> In this form, the text file does not seem to need #!.

Sounds correct

> This engine seems bloated; it is well over 2MB.  X11?
>

I just grabbed the darwin mc  from metacard.com. I ran "strip" on it, 
and filesize is still 2.7 MB. Must have been already stripped so that 
doesn't help. According to "otool -L", it links with only one shared 
library, libSystem. Also ran "strings < mc | grep -i lib" to see what 
kind of stuff it was compiled with.

Educated guess: it is statically linked with Xlib (X11), zlib, libpng, 
libjpeg and maybe others. Therefore the size. This seems rather a waste 
since the OS X version need not link with X11.

By comparison it's not that bad. The Revolution OS X engine is 3.5 MB 
and doesn't even have X11 libs in it. It strips down to only 3.1 MB.

> I seem to have forgotten most of what I know of unix from a quarter 
> century ago.
>
> I don't need cgi (yet).  I just want to do some command-line work.  
> Does this file (mc) go into /etc/bin or some other directory?  What 
> permissions and ownership should it have.
>

If the command ./mc helloworld.txt worked, then it's already executable.

sudo cp mc /usr/local/bin
or
sudo cp mc /usr/bin

To put it onto (probably) your path. Then create a text file with

#!/your/path/to/mc
e.g.
#!/usr/bin/mc

as the first line. Make the text file executable. Then you can run it 
just as ./myScript or ./myScript.sh or whatever

> I'm currently editing with TextEdit.  I am not able to type the text 
> file name to the terminal just as I would a program.  I get a 
> permissions error.  Do I need to make it executable?   TextEdit does 
> not make files executable.  The "get info" does not have an execute 
> option on permissions.  Do I need to go in and chmod each file?  Maybe 
> I need to make an editor with Revolution.

That's unfortunate about the Finder not exposing the execute 
permissions. I know there are 3rd party software that can do it from a 
GUI, or just use chmod from the command line that's what I do.

> I suspect I'm missing the obvious.

No I don't think so

> Even though I'm an old school lisp guy, I don't emacs and I had a 
> hypnotist purge all knowledge of vi years ago.  I think I did; I don't 
> remember vi, anyway.

Better learn Emacs then ;-) I distribute an binary, self contained app 
bundle of Emacs for OS X:
http://mindlube.com/products/emacs/

A non-GUI Emacs is also built OS X- which is nice for editing files as 
root from terminal.app

Alex Rice, Software Developer
Architectural Research Consultants, Inc.
http://ARCplanning.com




More information about the use-livecode mailing list