Mac OSX

Quick Links

my DNS serversFree DNS @ afraid.orgOzHosting
useful linksWhoIs databaseRebuilding Ubuntu (15.10) from scratchUbuntu Samba Server configuration

Hints and Fixes

Getting Apache to run under MacOSX 10.11, 10.12

  1. ensure ~/Sites is available (can be link to e.g., public_html)
  2. check that we have index.html, index.xml in this directory
  3. edit /etc/apache2/users/ajh.conf - it should look like
    <Directory "/Users/ajh/Sites/">AllowOverride AllOptions Indexes MultiViews FollowSymLinks ExecCGIRequire all granted</Directory>
  4. check that the file ajh.conf has permissions 664 and owner root:admin
  5. edit the /etc/apache2/httpd.conf file,and ensure the following modules are enabled/disabled:
    LoadModule authn_dbm_module libexec/apache2/mod_authn_dbm.soLoadModule authn_anon_module libexec/apache2/mod_authn_anon.soLoadModule authn_dbd_module libexec/apache2/mod_authn_dbd.soLoadModule authz_dbm_module libexec/apache2/mod_authz_dbm.soLoadModule authz_owner_module libexec/apache2/mod_authz_owner.so#LoadModule proxy_module libexec/apache2/mod_proxy.so#LoadModule proxy_connect_module libexec/apache2/mod_proxy_connect.so#LoadModule proxy_ftp_module libexec/apache2/mod_proxy_ftp.so#LoadModule proxy_http_module libexec/apache2/mod_proxy_http.so#LoadModule proxy_fcgi_module libexec/apache2/mod_proxy_fcgi.so#LoadModule proxy_scgi_module libexec/apache2/mod_proxy_scgi.soLoadModule cgi_module libexec/apache2/mod_cgi.soLoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.soLoadModule actions_module libexec/apache2/mod_actions.soLoadModule userdir_module libexec/apache2/mod_userdir.so
  6. The /etc/apache2/extra/httpd-vhosts.conf also needs to be adjusted. For dimboola, I use
    <VirtualHost *:80>ServerAdmin ajh@ajhurst.orgDocumentRoot "/Users/ajh/public_html/"ServerName dimboolaServerAlias dimboolaErrorLog "/private/var/log/apache2/error_log"CustomLog "/private/var/log/apache2/access_log" common</VirtualHost>
  7. Now restart the server
    sudo apachectl restart
    and check that the configuration is correct:
    sudo apachectl configtest
    which should reply with "Syntax OK". Rectify any flagged errors and restart.

Karabiner Keys

If you want to know what name to give various keys whenredefining them in Karabiner, please refer to this page.

Mail Folder Sort Order not maintained

My (Mac OSX) mail folders suddenly started being displayed innon-alpha order whenever I added a new folder. I'm not theonly person to notice this - there is an Apple DisscussionThread on it. Theoriginal pageis available, but in case it disappears, I've saveda copy atFixMailSort.html.Here is the gist:

Kenji KonoRe: Mail Not Sorting new Folders Added AlphbeticallyJan 28, 2010 8:05 PM (in response to Matt Garr)Hi,I'm not sure, but I suspect the new Snow Leopard feature ...http://www.apple.com/macosx/refinements/enhancements-refinements.html#mail... that lets you move folders around manually might be what's causingthe weird behavior.In Leopard, you could move a folder inside another folder but,otherwise, they would always stay in alphabetical order, I think.Anyways, in Snow Leopard (and Leopard for that matter), there's aninvisible file around ~/Library/Mail/<name of your emailaccount>/.mboxCache.plist It seems to keep a list of the mboxes inthat folder/account. In Snow Leopard, the first time you manually movean mbox out of alphabetical order, a new key calledMailboxDisplayOrder seems to get created in that plist for all theexisting "non-special" (i.e. not INBOX, Sent, Drafts, etc.) mboxes inthat folder. Once that key exists, it seems like new folders getappended to the end of the order.I don't know the right way to fix the problem though. I'm really justposting my observations, based on what I'm seeing on my computer. I'dbe very careful about manually messing with invisible files in yourmail, especially if you don't have a good backup. (No idea if you canrestore an invisible file with Time Machine.) A lot of this isguesswork. But I thought maybe it'd help someone.Later,k
The solution is to delete the offending.mboxCache.plist file. You should exit Mail before youdo this, and it will get rebuilt next time you run Mail.

Invisible files

When I first obtained a Mac, using (IIRC) Mac OS 3.1 orthereabouts, my son discovered that there was a resource forkbit that made files invisible. He delighted in changing thatbit on files that I used, so I rapidly discovered how to unsetit again. That facility is still there in OS X, so I havedocumented that little lurk to avoid any future mischief.

To make a file invisible:

$ /Developer/Tools/SetFile -a V file-name

(upper case V)

To make a file visible:

$ /Developer/Tools/SetFile -a v file-name

(lower case v)

Safari Plug-Ins

I installed/updated my Adobe reader, and the next time I usedSafari, it asked me if I wanted to install the Adobe plug-into make Safari use the Adobe reader for PDF files. I said yesat the time, but after a bit of use, found it too slow.Granted, it does have more features, but not the one I wanted,which was to open it up outside the browser. With thestandard Preview option, this was just a right-mouse pull down"Open in Preview", very convenient. But how to get back toPreview?

A bit of Googling revealed the answer. In Tiger (10.4) andLeopard (10.5), there is a folder /Library/InternetPlug-Ins/ that contains all the plug-ins. Remove the onecalled AdobePDFViewer.plugin, restart Safari, and youare back with Preview.

And while on the subject of Safari, here's how to change thedefault browser preference:

  1. Open Safari (/Applications).
  2. From the Safari menu, choose Preferences.
  3. Click the General button.
  4. Choose a different browser from the Default WebBrowser pop-up menu.
(from http://support.apple.com/kb/HT1637)

Time Machine Repair

A colleague had difficulties recovering his Time Machinebackups when he had his motherboard replaced, and he sent methis URL about a fix. It seemed like good insurance to add itto this page: http://www.macosxhints.com/article.php?story=20080128003716101

OpenOffice recovery documents

When Open Office (version 3) "loses" its recoveryfiles, and keeps asking to recover (non-existent) files, editthe file:/Users/ajh/Library/ApplicationSupport/OpenOffice.org/3/user/registry/data/org/openoffice/Office/Recovery.xcuto delete the element nodes containing the offendingfile path. Then save this file, and restart OpenOffice.

Finding out the screen resolution

I run a number of different displays, and when starting upvarious programs I need to know the current screenresolution. This little script does the trick:

#!/bin/bash## screenres      determine screen resolution 'HEIGHTxWIDTH'# screenres -w   determine screen resolution 'WIDTH'# screenres -h   determine screen resolution 'HEIGHT'#res=`xdpyinfo | awk '/dimensions/ {print $2}'`if [ "$1" = '-h' ] ; then# extract height and printexpr "$res" : '.*x\([0-9]*\)'elif [ "$1" = '-w' ] ; then# extract width and printexpr "$res" : '\([0-9]*\)'else# print full resolutionecho $resfi

Apple's X11 Cut and Paste

Apple did a Great Thing in making X11 available as part of OSX, but it was always going to be a difficult task, given thedifferent "look and feel" of the two user interfaces. Totry and fix the inconsistency between the OS X cut and paste,and X11's cut and paste, check out thisFix for Apple's X11 Cut and Paste

Keyboard Shortcuts on Booting

To find out all those nifty keyboard things when things go wrong, here's a page to describe theKeyboard Startup Shortcuts.

Automatically changing the Desktop Picture in Snow Leopard

I had a cool little script that changed the desktop backgroundpicture (aka wallpaper) automatically, according to parametersstored in an XML file. See this Multithreaded ImageViewer for details. Most of it was pretty plain pythonprogramming (I even set it as an exercise in concurrentprogramming one year), but it relied upon a shell scriptsetBackground.sh that used an Applescript script to dothe actual picture change via a set desktop picture to fileMyPicFile.

Here's what that script looks like:

#!/bin/sh## simple shell script to set the backgroup image# uses an Applescript call to do the actual work# call:#  setBackground.sh <imageFilename>FILE=$1#echo $FILE >>output.txt/usr/bin/osascript <<ENDtell application "Finder"set myFile to POSIX file "$FILE" as stringset desktop picture to file myFileend tellEND

But then it broke in Snow Leopard, for reasons I do notunderstand. Attempts to find how to do this task via muchGoogling also proved fruitless. While fiddling around with thestandard Apple Change Desktop Background pop-up memu, I hit onthe idea of having a folder with only one image in it, andsetting the reload time to 5 seconds, the shortest reloadtime.

Hence this new script for setBackground.sh. It lookslike this:

#!/bin/shFOLDER=/Users/ajh/Pictures/DesktopFILE=$1rm $FOLDER/*ln -s $FILE $FOLDER

I used a soft link without thinking about why. It could be ahard link, I guess.

(20100330:094441) And this is not perfect by any means. Itbreaks on my laptop when I put it to sleep, or change locations,or both, or neither (hard to say which, since it seems veryerratic!) Every so often I have to invoke "Change DesktopBackground", and reselect the folder in which the temporary itemis placed.

(20101216:160200) The behaviour in Snow Leopard is nowconsistent with Leopard again. I don't know what happened,but I now use the script identified at the beginning of thisitem. I'm keeping the rest of the story here just in case.

Filename extensions

I noticed while using Keynote that my filename extensions weregetting thrown away. I was not the only one to be puzzled by thisbehaviour, so I thought I should comment on the fix required.

Go to the Finder Preferences, and click the Advanced tab.Under Snow Leopard, the top check box should be "Show all filenameextensions". If this is unchecked, click it, and your filenameextensions will magically reappear!

For some reason, Apple appears to have changed the defaultvalue on this from Leopard to Snow Leopard, leaving many userspuzzled as to what is going on.

Fixing the X11 "Focus Follows Mouse" hassle

In a terminal, type:

defaults write org.x.X11 wm_ffm -bool true
and then restart X11.

This page is copyright, and maintained byJohn Hurst.143 accesses since
19 Jul 2020
My PhotoMy PhotoTrain Photo

Local servers:LocalhostNewportBurnleyEvertonKerangOuyenSpencerTerang(accessible only on local network.)
Public Web Servers:HurstServerHomeServer1HomeServer2InternodeServer(not all may be active.)
Dynamically generated at20210122:0248from an XML file modified on20181029:1231.

144 accesses since 19 Jul 2020, HTML cache rendered at 20210122:0248