Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.5: Use public keys with SSH in 10.5 UNIX
Leopard has now a built-in support for SSH authentication with public keys.

Just open Terminal and ssh to your public-key-enabled server. A Keychain window appears, proposing you to enter the pass phrase, and then remembering it in your keychain.

Just great!
  Post a comment  •  Comments (15)  
  • Currently 2.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[27,011 views] Email Article To a Friend View Printable Version
10.5: Restore Terminal's welcome message UNIX
After upgrading to Leopard, you'll probably find something missing when you first launch Terminal: "Welcome to Darwin!" For some reason, the file that generates this message, /etc/motd, is not included in Leopard. This means no message of the day in Terminal, or any other app that picks up on the motd file.

You can create a new one, though, using your favourite plain text editor in Terminal. For example, sudo vi /etc/motd. Press a to switch to add mode, then type whatever you'd like for a welcome message -- I went with "Welcome to Leopard!" but I guess "Welcome to Darwin" would have been more appropriate. When done, press Escape, then :w to write and :q to quit.

Next time you open a Terminal window, you'll see your new message of the day.
  Post a comment  •  Comments (30)  
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[13,040 views] Email Article To a Friend View Printable Version
10.5: Stop X11 from opening xterm on launch UNIX
X11 has changed in 10.5 to an xorg-based Xserver. Also, /etc/X11 no longer exists. The X11 startup list is now in ~/Library » Preferences » org.x.X11_launcher.plist. This file gets created if it's not there, or if the format is wrong.

To stop xterm from starting, simply change it to run xhost:
defaults write org.x.X11_launcher app_to_run /usr/X11/bin/xhost
[robg adds: This hint was submitted with app_to_start as the key name, but that didn't work for me. When I opened the prefs file, I found the key was app_to_run. When I tried it with the new key name, it worked as expected.]
  Post a comment  •  Comments (18)  
  • Currently 2.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (6 votes cast)
 
[23,690 views] Email Article To a Friend View Printable Version
10.5: Exploring OS X with dtrace UNIX
One of the new 10.5 tools for developers is a program called dtrace -- you'll need the Developer Tools installed to use this tool. From man dtrace, you can learn...
The dtrace command is a generic front-end to the DTrace facility. The command implements a simple interface to invoke the D language compiler, the ability to retrieve buffered trace data from the DTrace kernel facility, and a set of basic routines to format and print traced data.

Users new to DTrace are encouraged to read: How To Use DTrace. Sun Microsystems, 2005.
Wow, doesn't that sound thrilling!? You're right, it doesn't. But it turns out that dtrace can be useful for things that even mere mortals may be interested in. And the folks at MacTech have put together a (fairly geeky) dtrace how-to that provides some concrete examples of how you might put it to use. Read on for one example from there article, showing you how to watch file system activity in real time.
read more (189 words)   Post a comment  •  Comments (12)  
  • Currently 4.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (4 votes cast)
 
[47,416 views] Email Article To a Friend View Printable Version
10.5: Change your login shell in Leopard UNIX
To change the login shell of your account in Leopard, do this...

Control-click on your account name in the Accounts pane of System Preferences and choose Advanced Options in the contextual menu that appears (you'll have to unlock the pane first, by clicking the lock icon).

In the resulting Advanced Options screen, either type in the path to your preferred shell, or choose among the various shells already installed in /bin: bash, tcsh, sh, csh, zsh, or ksh. Finally, click on OK.

The note at the top of the Advanced Options screen claims you have to restart for the change to take effect, but you really just need to log out and back in again.
  Post a comment  •  Comments (7)  
  • Currently 4.10 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (10 votes cast)
 
[62,357 views] Email Article To a Friend View Printable Version
How to install Kile on Mac OS X UNIX
If you have ever used linux with KDE and you are writing on Latex, I am certain that you can recognise Kile as the best Latex editor around. This is a guide on how to use the excellent KDE Latex editor Kile on Mac OS X 10.4.10 (it should also work for 10.3) via Fink, MacTex, and Apple's X11. An Automator script wraps the appropriate commands up and lets you place Kile in your Applications folder. I used the latest KDE 3.5.8. wbr I will try to make this as analytic as I can, since I have not seen any other guide that delivers the full Kile power in Mac OS X.

NOTE: Before following this tutorial and if you do not desperately want Kile, try Texmaker. It may meet your needs.

Conventions: Any line starting with $ is a Terminal command that needs to be copied and pasted into Terminal (without the $), and then press Return to run it.

Requires: A broadband connection (it is a large download) and at least three hours' worth of patience. Apple's X11 and generally the Developer Tools are also required. You can install both from the OS X install CDs. I have not tried it, but XFree86 (the open source X11 on which Apple's one is based upon) should work equally well.

Read on for the detailed how-to.
read more (771 words)   Post a comment  •  Comments (6)  
  • Currently 3.14 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (7 votes cast)
 
[75,397 views] Email Article To a Friend View Printable Version
Use Growl to monitor long-running shell commands UNIX
While waiting for long-running shell commands to finish, I often switch to Mail or Safari. Here's how I made Bash notify me via Growl whenever one of those commands finishes. It's a combination of a clever bash script by glyf and Growl's growlnotify shell script. Install Growl, including the growlnotify shell script (found in the Extras directory). Next, download preexec.bash.txt [hints mirror] and save it under ~/.preexec.bash, as an invisible file in your home directory (in case you choose a different filename or location, make sure to adjust it in the following script).

Then add the following code to your ~/.bashrc:

. ~/.preexec.bash

# called before each command and starts stopwatch
function preexec () {
	export PREEXEC_CMD="$BASH_COMMAND"
	export PREEXEC_TIME=$(date +'%s')
}

# called after each command, stops stopwatch
# and notifies if time elpsed exceeds threshold
function precmd () {
	stop=$(date +'%s')
	start=${PREEXEC_TIME:-$stop}
	let elapsed=$stop-$start
	max=${PREEXEC_MAX:-10}
	
	if [ $elapsed -gt $max ]; then
		growlnotify -n "iTerm" -m "took $elapsed secs" ${PREEXEC_CMD:-Some Command}
	fi
}

preexec_install

Now whenever a shell command takes longer than 10 seconds to finish, Growl will notify you about it. To change the threshold temporarily, use export PREEXEC_MAX=20. To change it permanently, just change it in the code you just appended to ~/.bashrc.

[robg adds: I haven't tested this one.]
  Post a comment  •  Comments (22)  
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[18,661 views] Email Article To a Friend View Printable Version
Start matlab sessions on Linux clusters from your Mac UNIX
Do you need to evaluate lots of all-day computations in parallel on different data sets (i.e., prediction features on EEGs of different epileptic patients)?

Do you have basic Linux scripting knowledge?

Do you want a script-based "three-click-Apple interface" that distributes your ever evolving matlab code, quickly changing control scripts, which is developed on your Mac (but not the static raw data), to your homes and various computer clusters, and run the computation job there with a single command?

Do you have an ssh connection from your Mac to the clusters that cannot be kept up all the time?

If so, I've written a detailed tutorial explaining how to do the above.

[kirkmc adds: Typically we would ask for permission to run the blog linked above as a hint here. However, this one is very long and very specific, and probably applies to only a few users. As such, we've just left the link to the original post in place. Untested by me.]
  Post a comment  •  Comments (1)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[5,382 views] Email Article To a Friend View Printable Version
Scripts to create encrypted backups to online services UNIX
I've been testing mozy.com for online backups, but they charge after you go over 2GB of data, and their Mac client is still in beta and not quite stable. Then I read about using a dreamhost account for storage, which interested me as I have a dreamhost account with 200GB+ of available storage. The guide I linked to above was published by Michael Lee, and the method he suggests uses rsync, which does incremental backups so it only backs up changed files. But unfortunately, it stores your data as is, which could be potentially read by anyone if they manage to get access to your dreamhost account.

A better solution is to use an open source package called duplicity, which uses librsync for incremental backups as well, but also uses gpg to encrypt your data. It does have some limitations related to hard links. That should hopefully not be an issue for backing up your documents and photos, but may mean it's not suitable for full system backup including the OS. See the duplicity docs for more info.

I'm using dreamhost, but this hint should work with any server to which you can write files.
read more (1,719 words)   Post a comment  •  Comments (20)  
  • Currently 3.00 / 5
  You rated: 3 / 5 (6 votes cast)
 
[25,080 views] Email Article To a Friend View Printable Version
Using locale in PHP on OS X UNIX
I was looking around, trying to find out how to get locale to work in PHP on OS X. After some searching, I found the solution and wanted to share this to save you some work. In Linux, one can do this:
setlocale(LC_ALL, 'nb_NO');
echo strftime(" %A %e %B %Y ");
To get it work in PHP on OS X, you must write it like this:
// set date format to Norwegian:
setlocale (LC_TIME, "no_NO.UTF-8");
// output the date
gmstrftime('%A %e %B %Y, %H:%M');
locale is probably not in your profile path, so you have to look in the locale folder to find your language:
$ ls /usr/share/locale
There you can find the languages you can use; some languages have different locale versions. Note that the encoding of the page must correspond to the locale you are using. That is, if you use no_NO.UTF-8, then you must have in your head:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Take a look at some date formatting tips for gmstrftime for more help.

[robg adds: I haven't tested this one.]
  Post a comment  •  Comments (0)  
  • Currently 3.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[7,308 views] Email Article To a Friend View Printable Version