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

10.5: Create executable command-line AppleScripts UNIX
It looks like AppleScript 2 in Leopard now supports # as a comment character, so it's possible to have a unix world-executable AppleScript, eg:
tell app "iTunes" to pause
Save that as and chmod +x it. Much better than the old 'here doc' method.

[robg adds: A comment on the queue review site indicates that you can name your script anything you like; it doesn't have to end in .sh. More info can be found in the AppleScript release notes.]
  Post a comment  •  Comments (11)  
  • Currently 2.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (4 votes cast)
[20,135 views]  View Printable Version
10.5: Some additional replacement tools for NetInfo UNIX
This may be more a server admin topic, but since there isn't one for Leopard Server I'll mention it here.

Yes, many have noticed (and some with great joy) that NetInfo is no longer part of the client OS (it's been gone from the server for a while). Most notably, NetInfo Manager is gone, replaced by Directory Utility, advanced settings in the Accounts System Preference (right-click on a user to see it), and some command line tools. The root account can be enabled from Directory Utility or use dsenableroot from the command line.

The main point of this hint is that all the ni* command line tools are gone, too. If you have written scripts to e.g. create a new user using the ni* tools, now is the time to rewrite them using dscl and other related tools:
  • Use dsimport in place of niload
  • Use dsexport in place of nidump
  • Use dseditgroup for group management
Although the NetInfo database itself is gone, the equivalent data is at /var/db/dslocal -- and in plist XML format, so it's fairly easy to read and modify. As with all changes to critical data structures, I'd suggest having a good backup before making changes. Changes at this level could render your system unbootable.

[robg adds: We've covered other aspects of NetInfo's demise, but there's some new info in this hint.]
  Post a comment  •  Comments (0)  
  • Currently 3.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
[17,607 views]  View Printable Version
10.5: How to enable PHP and MySQL in 10.5 UNIX
Getting a working an Apache, MySQL, and PHP environment running in Leopard Client is quite easy. Included with OSX 10.5 are Apache2 and PHP 5.2.4, although PHP is disabled by default. So let's start by enabling PHP.
  1. Open Terminal and navigate to the apache2 directory by typing cd /etc/apache2
  2. Using your text editor of choice, open httpd.conf; in this case, we'll use pico. We must use sudo, however, as root is the owner of httpd.conf: sudo pico httpd.conf
  3. Press Control-W and search for php; uncomment the line that loads the php module by deleting the # at the front, leaving this: LoadModule php5_module
  4. Save the changes by pressing Control-X, then press Y, then press Enter.
Get MySQL Ready

Apple was kind enough to compile php with support for MySQL, so we simply need to download the proper Tiger install package for your Mac. Run the package installer, and follow the onscreen instructions to install mysql. Cool! Done, right? Not quite, we must tell php the proper location of the mysql socket. Open up Terminal again, and navigate to the php.ini.default file by typing cd /etc.
read more (182 words)   Post a comment  •  Comments (3)  
  • Currently 3.29 / 5
  You rated: 2 / 5 (7 votes cast)
[99,413 views]  View Printable Version
Drag and drop text clippings to run Terminal commands UNIX
This is one I stumbled upon by complete accident: Text clippings can be dragged and dropped into a Terminal window to run a succession of commands.

To run a single command, the text clipping needs to include the command and a trailing carriage return. Multiple commands may be run in succession by separating them with carriage returns, and following the last command with a trailing carriage return.

[robg adds: At first I thought this tip referred to dragging and dropping text from one app to another, which we've covered here quite a few times in the past. However, it's referring (I believe) to the actual text clipping file you get if you, for instance, drag a snippet of text to the desktop. You can then drop that icon into a Terminal window to execute the commands it contains. You can use semicolons to separate commands on one line, and a backslash-carriage return to continue one command on a new line. I tried it with a simple ls -al; top -u 10[CR] that I created in TextEdit, and it worked as described.]
  Post a comment  •  Comments (2)  
  • Currently 1.50 / 5
  You rated: 1 / 5 (4 votes cast)
[5,323 views]  View Printable Version
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.50 / 5
  You rated: 4 / 5 (8 votes cast)
[30,302 views]  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.60 / 5
  You rated: 4 / 5 (5 votes cast)
[14,517 views]  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.56 / 5
  You rated: 2 / 5 (9 votes cast)
[24,907 views]  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.29 / 5
  You rated: 5 / 5 (7 votes cast)
[52,740 views]  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.00 / 5
  You rated: 4 / 5 (13 votes cast)
[71,815 views]  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.20 / 5
  You rated: 3 / 5 (10 votes cast)
[85,955 views]  View Printable Version