On the German Apple keyboard a number of characters are missing. These characters require the following key combinations:
| Character | Key Combination |
|---|---|
| ~ | Alt-N + Space |
| @ | Alt-L |
| | | Alt-7 |
| \ | Shift-Alt-7 |
| [ | Alt-5 |
| ] | Alt-6 |
| { | Alt-8 |
| } | Alt-9 |
The Apple documentation calls the ALT key "option key" and the Apple key (aka as "cauliflower key") "command key". On iBooks there is an additional "fn" key which is necessary to modify the arrow keys and the backspace key (FN + Backspace = Delete).
Alternatives to Terminal.app are xterm or iTerm. xterm is an X11 application and thus reads its configuration from "Xresources" stored in ~/.Xdefaults. The advantage of xterm is that it allows to customize the word separating chars with the xterm*charClass Xresource. This makes it possible to select paths and filenames with a double click. In Terminal.app this does not work because word boundary characters are hard wired into Cocoa (the OSX GUI programming library).
The keybindings in Cocoa however can be customized as described by Llew Mason. This in particular useful as the Cocoa default bindings of the HOME and END key are different from every other OS or GUI environment (I have used a lot and none maps HOME to "beginning of document" except Cocoa).
| German Finder name | Real Name |
|---|---|
| /Programme | /Applications |
| Schreibtisch | ~/Desktop |
| /Benutzer | /Users |
| /Programme/Dienstprogramme | /Applications/Utilities |
A number of directories/files are invisible in the Finder. Nevertheless they can be opened in the Finder from the command line with open .... You can change the visibility of directories/files with SetFile (Developer-Tools).
Beside the MacOS X specific "invisibility flag", the Finder also hides files with a beginning dot (these are "hidden files" in the Unix world). There is no way to make these files visible in the Finder which means that they are only accessible from the command line.
Additionally you need OMCEdit to configure the context menus in an easy way. To start for instance an xterm in the current directory you can add the following command in OMCedit:
osascript -e 'tell application "X11" to activate'; cd __OBJ_PATH__; DISPLAY=:0; export DISPLAY; /usr/X11R6/bin/xterm &
The final ampersand (&) is essential because otherwise xterm would block all other applications. Note that this command explicitly sets the DISPLAY variable which fails in a multi user environment. See GUI and X11 for a better solution.
If you want to use Terminal.app instead of xterm, you can invoke it with AppleScript. The problem with Terminal.app however is, that it opens an additional window when it is not already running, so it is necessary to figure out whether Terminal.app is already running. The following command for OMCEdit does the trick:
osascript -e 'tell application "System Events"
if (count(processes whose name is "Terminal")) is 0 then
tell application "Terminal"
activate
do script "cd " & quoted form of "__OBJ_PATH__" in window 1
end tell
else
tell application "Terminal"
activate
do script "cd " & quoted form of "__OBJ_PATH__"
end tell
end if
end tell'
The Finder offers no key or menu entry for updating a folder view. The following AppleScript does this:
try
tell application "Finder"
set the_Folder to (the target of the front window)
update every file in the_Folder
update every file in the folder of the_Folder
end tell
end try
You can save this script as "Program Bundle" in AppleScript Editor and drag and drop it on the Finder toolbar. In order to prevent the running script from appearing in the dock, add the key LSBackgroundOnly with value "1" in the file Info.plist in the application bundle (for a full list of possible keys see the Apple Developer Documentation). I have prepared a ready to use application bundle as UpdateFinder.zip
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -dump
Moreover you can view your user specific associations in ~/Library/Preferences/com.apple.LaunchServices.plist. Applications are identified by the parameter CFBundleIdentifier from the info.plist file in the application bundle.
I have found no other way to change the associations than over the "information" context menu in the Finder (also accessible with Apple-I). When this does not work, there are two things you can try:
tell application "X11"
activate
end tell
do shell script "source /sw/bin/init.sh && cd $HOME && open-x11 gimp"
Save this script in the script editor as "Application" (German: "Programm").
The interactive Python interpreter shipped with MacOS X does not support command line editing by default. You can enable it on OSX 10.3 with
sudo python `python -c "import pimp; print pimp.__file__"` -i readline
On OSX 10.4 this does not work. Here is however a standalone python readline module made by Bill Bumgarner that you can install with distutils (see the included README.txt for details) on top of the python shipped with OSX 10.4.
Moreover the Xcode tools contain an IDE for the development of Aqua programs and some other useful tools like an icon editor or FileMerge (look at /Developer/Applications/Utilities), a graphical diff utility which supports drag&drop of files from the Finder. Note that FileMerge can also be invoked from the commandline with opendiff.
These Resource-Forks have the ugly side effect that they get lost when you pack an archive with zip or tar. Thus you must build your archive in a different way:
Shared libraries are loaded by the system at program start; on Linux they have the extension *.so and on MacOS X the extension *.dylib. To check the required shared libraries for a program use ldd on Linux and otool -L on MacOS X.
Dynamically loaded libraries or loadable modules are loaded by the program with special library functions (dlopen on Linux, LoadLibrary on Win32). On Linux they have the extension *.so, on MacOS X *.bundle. The use of loadable modules with dlopen is described in the Program-Library-HOWTO. Thanks to the dlcompat library these instructions also work on MacOS X.
Packages can be built with PackageMaker (in /Developer/Applications/Utilities), but this is a nontrivial process. Easier is the use of ESP Package Manage, which has the nice side effect that it also supports the creation of RPM, DEB etc. packages without any additional effort. Make sure that you call epm with sudo (e.g. sudo epm -v -f osx ...) to avoid wrong file ownerships which can cause trouble on the target system!
The lack of a decent built in package management system is one of the most serious drawbacks of MacOS X. It has resulted in a plethora of third party solutions for this problem (Fink, DarwinPorts, iInstaller, OSXPM, ...), which are incompatible with each other.
Fink uses the Debian package management system, which means that you have to use dpkg and apt, e.g. sudo apt-get install .... The downloaded deb-packages are stored in /sw/var/cache/apt/.
Beside apt/dpkg it is also possible to install from the sources with sudo fink install .... The source packages are stored in /sw/src, the compiled deb-packages in /sw/fink/debs. Make sure that the latest gcc3.3 shipped with Xcode is the default compiler before calling fink install. Some packages (e.g. Emacs on Panther) only work when build from the sources.
Some packages are placeholder packages for software that has been installed on a different way beside Fink (e.g. Apple's X-server instead of Finks). These packages are necessary to formally fulfil Fink's internal dependency checks. Some examples:
| Dummy-Package | Description | possible external Source |
|---|---|---|
| system-xfree | Xserver | ships with MacOS X 10.3 |
| system-java.. | Java | ships with MacOS X 10.3 |
| system-perl | Perl | ships with MacOS X 10.3 |
| system-tetex | LaTeX | //www.rna.nl/ii.html |
If you use X11 applications regularly you should add X11 to your startup items (in "Systemeinstellungen/Benutzer"). The automatically started X11 applications are configured in ~/.xinitrc (see the default configuration /etc/X11/xinit/xinitrc for an example); useful is e.g. the addition of xset b off to suppress the beeping. For security reasons it is a good idea to disable network access in the X11 preferences dialog.
Starting X11 applications on MacOS X prior to 10.5 can be a little tricky because they need the environment variable DISPLAY. When only one X-server is running, it typically has DISPLAY=:0.0. In a multi user environment however, this is no longer true and using a constantly preset value for DISPLAY will fail. There are two possible workarounds for this problem:
for x in 0 1 2 3 4 5 6 7 8 9; do
if [ -O /tmp/.X$x-lock ]; then
DISPLAY=:$x.0; break
fi
done
Using the second approach, I have written a little script open-xapp for starting X11 applications; for instance you can start a root shell xterm with the command open-xapp xterm -e "sudo bash". The script also autodetects the OSX version and skips the DISPLAY setting step on OSX 10.5.
A common problem with X11 is that client programs can't connect to the display server because they use bogus authentication data. In that case you will get the error
Xlib: connection to ":0.0" refused by server
Xlib: Client is not authorized to connect to Server
Solution:
rm $HOME/.Xauthority; touch $HOME/.Xauthority
Screenshots are possible with Apple-Shift-3 (entire screen) or Apple-Shift-4 (region). This saves a PDF file on the desktop. Another option is /Applications/Utilites/Grab.app (saves as tiff).
A more flexible method is the use of mkisofs and cdrecord, which are part of Fink. I have written a small script write2cd to simplify the use of mkisofs/cdrecord. When using this script it is important that the CD is not mounted:
A nice graphical man page viewer is ManOpen.
Occasionally it is necessary to convert a file from Windows to Unix line breaks and vice versa. With the aid of flip, Platypus and CocoaDialog I have built a small application on which you can drop files and which asks you how to convert these files. The application is downloadable for free as ConvertNewlines (universal binary). To learn more about how it works, have a look at the file Contents/Resources/script within the application bundle.
net.inet.tcp.delayed_ack=0
This will have effect after a reboot. You can test this setting for the current session with the command sudo sysctl -w net.inet.tcp.delayed_ack=0.
| Back to Homepage | Christoph Dalitz, 2009-07-07 |