If anyone else out there uses the OSXvnc server from osxvnc.com [Update: osxvnc.com is no longer a Mac-related website; the domain expired and it's now run as a porn site! Do not try to visit there!] and used the OSXvnc-wrapper solution posted there to get it to automatically run and stay up, you may be interested in this script. You will have no doubt noticed when installing Classic applications under 10.1 that when it says it must close all applications, it means OSX applications as well. This gets into an interesting loop where it kills OSXvnc, which respawns, which then gets killed, etc. As a "hack" solution, I use the following as a replacement for the OSXvnc-wrapper file:
while true do while [ `ps -aux | grep 'Dock.app' | grep -v 'grep' | wc -l` = 1 -a `ps -aux | grep 'Finder.app' | grep -v 'grep' | wc -l` = 0 ] do sleep 1 done /Applications/OSXvnc.app/Contents/MacOS/OSXvnc-server `cat /etc/osxvnc-args` sleep 10 done
[Editor's note: the "while" command just inside the first 'do' loop has been broken onto two lines for easier readability. Put a space after "aux" and then everything from line two onto the same line.]
What it does is check to see if Dock is running but Finder isn't (this happens when you are installing software that requires closing everything) and if so, waits for this to change. Once it runs, if it gets killed for any reason, it waits 10 seconds and starts checking again. The 10 second wait was necessary since momentarily after killing OSXvnc, both Dock and Finder are still running (finder hasn't been killed), and OSXvnc will start up again and get in the weird loop again.
I got frustrated and created this when that mysterious loop cuased me to force boot one too many times and it corrupted my FS... :( now I don't have to worry about it :)
efax is a small, free, command-line fax program developed under Linux. It compiles with very little tinkering under 10.1, and I have successfully sent and received faxes with it using the internal modem on my Powerbook G4. efax communicates with the modem using POSIX /dev interfaces, so I don't see why it shouldn't work with just about any modem that is supported by OS X.
For now, installing and using it is a bit (OK, very) command-line intensive, but it should be easy to wrap this up in an installer package and add a GUI interface (which I might do if I find the time - but I wouldn't be upset if someone beat me to it). Fax capability is essential for OS X, and FaxSTF X from Smith Micro is a complete disaster (I am one of the fools that sent them my money).
I have written a brief document explaining how I have used efax and ghostscript to send and receive fax documents in pdf format.
[Editor's note: In fact, a free Cocoa front-end to efax has just been released, called Cocoa eFax. It includes the efax UNIX program along with the Cocoa front end, but I have not tested the program so I can't vouch for it one way or the other. I also haven't tested FaxSTF, so I can't comment on that package, either.]
Type cvs -v in the terminal to see which version you have. More than likely you'll see Concurrent Versions System (CVS) 1.10 `Halibut' (client/server)
Here's how to compile version 1.11.1p1. These instructions will replace the existing Apple-supplied CVS files including the html documentation. By default, 'make' wants to install texi info files for the docs, but we're going to trash those and create html versions instead, as with Apple's distribution. Also we change the other default UNIX installation directories to use Mac OS X specific ones.
Read the rest of the article for the step-by-step instructions.
In other *nix prompts, you can do history searches for partial commands. For instance, if you find yourself typing "telnet 192.168.1.12" repeatedly, you can type "tel and hit Page Up to search for the last command you typed that began with "tel" You can hit Page Up repeatedly to find the previous command that began the same way. You can also hit Page Down to go forward in the search if you hit Page Up too many times and missed the command you wanted.
Terminal uses Page Up and Page Down for scrolling, which is great for new users, but seriously slows power users down. Other unices use Shift-Page Up and Shift-PageDown for scrolling.
To restore command completion from history (in bash), you can use (mind the quotes!):
This binds Option-E to the reverse search (Page Up on Linux) and Option-R to a forward search (Page Down on Linux). To use this, the "Option (alt) key acts as meta key" item under Emulation in Terminal preferences must be on.
I put these commands in my .profile so that my terminal would always be configured to my tates. I'm sure there's an analogous command in tcsh.
On a side note, if you want a more powerful history search, you can hit Control-R to do a full interactive history search under bash. You hit Control-R at the prompt and type some text. Each letter you type will make the search more detailed. For example, if you want to find the last command that you executed with 192.168.1.12 as a parameter, you can hit Control-R and begin typing the IP. When you type the "1" the last command with a "1" in it will be displayed. When you type "9" the last command with a "19" in it will be displayed, and so on. Hitting Control-R again tries to find another command that matches.
Since I installed OS X, I've wanted to be able to pop up Terminal windows that have a specified title and are running a specified application. I'm about 90% there, and thought I'd share what I've written with the MacOSXhints gang.
Note that this is a Unix shell script that you'll want to copy onto your system, save with some name ('newterm'), then use chmod +x newterm or similar to ensure that it's executable.
Then you can start up a new Terminal window with the title "my terminal" and the core shell of /usr/bin/vi (for example), with:
newterm "Edit Window" "/usr/bin/vi"
Pretty cool, eh?
Read the rest of the article for the "new term" shell script.
This tip is stolen from instructions in the Bash Prompt HOWTO. It's not terribly innovative, and most Unix distributions (MacOS X included) come with a tolerably decent default prompt; consequently, even many very experienced Unix users don't know a lot about prompt configuration (I certainly didn't). But if you compile and install bash on MacOS X, you'll find that you are left with a very unsatisfactory default prompt. It was this problem that led me to sniff this information out.
This tip solves the dilemma of whether to use \W (current directory without path) or \w (complete path to current directory) in the prompt. On the one hand, \W doesn't contain the path (am I in /etc or /usr/local/etc?), but \w (which contains the path) can monopolize the command line. The solution: Include only the last x characters of the current working directory.
This tip will work swimmingly with bash, and maybe someone can explain how to do the same thing with tcsh in the replies (I'm a bash partisan myself, and I heartily recommend it to anyone who has to use the shell regularly). Read the rest of this article for instructions on creating a fixed-length bash shell prompt.
This tip is a shell setup technique that I have stolen from Mandrake Linux. It is only good for people that have heavilly customized their /etc/profile file, so the instructions assume a good deal of terminal knowledge. Instead of having one, monolithic profile file that is littered with different commands and environment settings, you can modularize it into a bunch of tidy, discrete items. You can do this as follows:
su to root and cd to the /etc directory.
Create a directory in /etc called profile.d.
Use your favorite console text editor to add the following lines to the beginning of your profile file:
for PROFILE_SCRIPT in $( ls /etc/profile.d/*.sh ); do . $PROFILE_SCRIPT done
Convert all of the commands in your profile file to individual shell scripts, and save them in /etc/profile.d (make sure they end in .sh), and delete them from /etc/profile.
Voila! Instead of having one, confusing, hard to navigate profile file, you have tidy, individual scripts. For example, my alias for ll (I use bash, so that ll is not built in) is in /etc/profile.d/alias_ll.sh, and my prompt code is in /etc/profile.d/prompt.sh.