The new X11.app Version 2.0 introduced with Leopard has a lot of bugs. Some of the issues (and workarounds) are discussed in this excellent thread over on the macosxhints forum site. Also, the people from x.org have released updated X11-libraries and an updated Xquartz server; you can read about them here.
[robg adds: The thread on the macosxhints forums contains a ton of information culled from various sources about what works and what doesn't work, and how you can fix some (but not all) of the issues. ]
I see a lot of hints, such as the one to remove 10.5's translucent menu bar, that tell you to restart your computer for the changes to take effect. However, you only really need to restart the WindowServer, which handles the graphical part of the system. I just do that in Terminal, with this command:
sudo killall -HUP WindowServer
Warning: All your opened programs will quit immediately! This is like a restart, but of only the graphical part of the system. Quit your open programs first! You have been warned. Here's what happens:
kill is a program to send signals (terminate or just "signals") to Unix programs -- and in OS X, all programs are Unix programs. killall is the same, but you can use the name of the program instead of its process ID (pid). The dark side is that if you have more than one program with the same name, all programs will receive the kill signal.
-HUP is a signal that usually says to the process that configuration files are changed and the process must be restarted.
WindowServer is the program that manages the graphical side of OS X.
You can see all the available signals by typing kill -l, but play with care!
[robg adds: A comment on the queue site notes that this may be useful for those times when the GUI locks up, if you're still able to connect via ssh -- try a restart of the window server before forcing a full reboot.]
Note: This hint is not correct. However, there's good information in the comments about why, along with workarounds. Please do not implement the hint, but if you're looking for alternatives, check the comments.
After much frustration, it seems that I have found a bug in 10.5. When doing unix scripting, it's useful to be able to do something like the following:
However, when using /bin/sh as the shell, echo -n no longer works. This is pretty much the most basic of basics in the unix world, and it just irks me that it's giving me grief. You can, of course, fix it by changing your shell to bash instead of sh, ala:
#!/bin/bash
Unfortunately, that only affects you. If there are other scripts you are running that you don't want to modify yourself, then you need to do something more drastic.
I'm a big fan of locate, even in this day and age of Spotlight; it's a super-fast way to find things in Terminal (with the downside that it needs updates to remain current, as it's a static index of file names). By default in 10.5, locate won't find files on Time Machine drives -- this is probably a good thing, as it greatly increases both the size of the database and the number of returned matches.
However, I was working on a project, and I wanted this information in locate. The solution is pretty simple: you need to edit /usr/libexec/locate.updatedb (with sudo). Look for this line:
Edit it to remove the */Backups.backupdb bit, then save your changes, quit the editor, and update the database (sudo ./locate.updatedb from that same directory).
For all you Leopard users out there, here's a handy tip on how to use Quick Look from the command line.
Leopard ships with a command called qlmanage. The -p option shows a preview of the file passed to the command. In the terminal, type the following:
qlmanage -p thefile
As you'll see, it also generates a ton of text output when run. You can prevent this by creating the following shell script:
#!/bin/bash
qlmanage -p "$@" >& /dev/null &
The >& /dev/null prevents output from displaying, and the final & runs the process in the background so a new prompt displays in Terminal. Save this script as an executable file and store it somewhere in your PATH (I stored mine in a home bin folder used for custom-made scripts). I recommend naming it something short like ql.
When using the script, you can close the Quick Look window with the mouse (the conventional way), or close it in Terminal by getting the pid from the ps command and using kill pid#.
[robg adds: This hint originally appeared on the author's blog; check there for any udpates. I actually prefer the script without the last &, as you can then close the Quick Look window with a Control-C (but you cannot work on anything else in that same window until you do so, of course).]
Quartz-wm no longer keeps windows from sliding under the menu bar at the top of the window. You can now stuff the title bar of the window up under the menu bar of the screen and loose the ability to move the window back out again. Grrr.
The solution? Run a different window manager (the venerable twm comes with Apple's X11) and set the title bar height larger than the menu bar height.
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:
#!/usr/bin/osascript
tell app "iTunes" to pause
Save that as pauseitunes.sh 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.]
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.
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.
Open Terminal and navigate to the apache2 directory by typing cd /etc/apache2
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
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
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.
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.]