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

Option-click Airport menu to launch Wi-Fi Diagnostics Network
A hint last year mentioned Wi-Fi Diagnostics, an application hidden in /System/Library/CoreServices. It turns out that you can also access this by Option-clicking the AirPort menu in your menubar and choosing Open Wi-Fi Diagnostics.

[kirkmc adds: This was available under Lion, but wasn't in the original hint, so it's worth posting.]
  Post a comment  •  Comments (8)  
  • Currently 2.50 / 5
  You rated: 1 / 5 (12 votes cast)
 
[5,378 views] Email Article To a Friend View Printable Version
Remotely connect to a Mac via SSH using iCloud's network Network
If you're running two Macs with iCloud support (Lion or Mountain Lion), then you can use iCloud's network to remote SSH back into your home computer no matter where you are with just a few commands in Terminal.

The process is explained by the One Thing Well blog, but you need to set up a few things before you get started. First, you need to make sure Back to My Mac is enabled in iCloud (System Preferences > iCloud > Back to My Mac). Next, you need to set up your home computer for sharing if it isn't already. Head to System Preferences > Sharing and turn on at least File Sharing and Remote Login. With everything set, you can now remotely log in to your home computer using iCloud's network wherever you have internet access.

To start with, you need to do is find your Back to My Mac account number. In Terminal (Applications > Utilities), type:
dns-sd -E
The final nine digit number is your Back to My Mac account number. Next, it's time to SSH into your other machine:
 ssh -2 -6 username@computer-name.[account number].members.btmm.icloud.com 
If you don't know your username or computer name, head to System Preferences > Sharing on the destination computer and click on Remote Login. Your Computer name is listed at the top (if it's multiple words use the address with the dashes). Your username is listed on the line below Remote Login right before the @ symbol. You will need to do this before you try to SSH into your computer when you're away.

With that, you should have access to your Mac no matter where you are. Head over to One Thing Well for a few more tricks and shortcuts for using the iCloud network to remote SSH.

[kirkmc adds: I haven't tested this.]
  Post a comment  •  Comments (9)  
  • Currently 2.69 / 5
  You rated: 1 / 5 (26 votes cast)
 
[27,152 views] Email Article To a Friend View Printable Version
Flush DNS cache in Lion and Mountain Lion Network
I came across this Apple technical note this morning, which describes how to flush the DNS cache on your Mac. We have a hint for 10.5, which is also valid for 10.6, but we're not up to date.

So, as a reminder, to flush the DNS cache in Mac OS X 10.5 and 10.6, run this command in Terminal:
sudo dscacheutil -flushcache 
To do the same in 10.7 and 10.8, run this command:
sudo killall -HUP mDNSResponder 
As Apple points out, you might need to do this in the following situation:

"OS X keeps a local cache of resolved DNS queries for a time defined by the DNS server, but sometimes it may be necessary to reset the cache immediately and re-query a DNS server. For example, you might do this after an entry on the server is changed or a new entry is added."
  Post a comment  •  Comments (8)  
  • Currently 3.85 / 5
  You rated: 4 / 5 (13 votes cast)
 
[82,440 views] Email Article To a Friend View Printable Version
Clear out phantom NFS shares Network
This is a hint about phantom NFS shares that may linger on your system long after you stopped accessing the share, and that may cause slowdowns and errors with various disk utilities. The information here applies to Lion, and may differ in earlier and later versions.

I used to have a NAS device that I named "dns323," and which was visible in the Finder as an NFS share. (The unit used a Linux-formatted disk.) In the past few months, whenever I used the excellent Yasu system maintenance utility, it would report an error message, saying that the file "dns323" wasn't found. I eventually realized that this problem started when I stopped using that NAS device. I also noticed that Find Any File was starting very slowly; and when I used Find Any File to see if it could find any trace of "dns323," it listed the file in its results list, but said that the item had disappeared.

I eventually realized that there was a directory named "dns323" in my user folder, but that directory wasn't visible in the Finder, even if I made invisible files visible. The directory name was visible in Terminal, but if I tried to cd into it, I got a message saying "Connection refused." None of the standard Unix commands for deleting a directory had any effect; I typically got a message saying "Resource busy" when I tried.

Eventually, with the help of the experts on the forum on this site, I found that "dns323" was listed in the table of mounts that appeared in Terminal when I entered typed the df command. The dns323 item was listed as "map -static" which, as I understand from other posts, means that it's a mount that isn't actually mounted, but which the system has ready for mounting when needed.

After a lot of other effort, I finally discovered what was creating this phantom mount. There was a .plist file in this folder: /var/db/dslocal/nodes/Default/mounts. The .plist file contained a name that was something like 10.0.1.8%2Fmnt_a2.plist (I'm writing that from memory); the name began with the IP address that the share had when I used it.

I didn't try deleting or moving this plist file while running OS X normally, but I think (on the basis of other postings in other forums about similar files) I could have used sudo rm <filename> to delete it. Instead I booted into single-user mode and moved the file to another location where I could restore it if needed (although I didn't need it). I then booted normally again, opened Terminal and entered rmdir ~/dns323, which was successful.

After this, Find Any File started working at top speed again, and Yasu stopped reporting an error. If file utilities and directory listings seem sluggish on your system, then it may be worth looking for files that create phantom shares in the directory listed above.
  Post a comment  •  Comments (8)  
  • Currently 3.17 / 5
  You rated: 1 / 5 (12 votes cast)
 
[9,110 views] Email Article To a Friend View Printable Version
Airport Utility 6.0 Network
Airport Utility 6.0 was released a few days ago.

You may want to keep both 5.6 and 6.0 versions. I used Pacifist, and manually reinstalled the 5.6 version side by side. Lots of missing features in the new utility. No way to tweak wireless options for Mode, Frequency, Multicast Rate or Transmit Power, and such a tiny window for port mapping list. An elegant interface, but at a price.

For a thorough review and pointers to stand alone updates, read here.

[crarko adds: Consider this a public service announcement. It also appears that AirPort Utility 6.0 only functions with the 802.11(n) compatible base stations, so that old AirPort Express you may have (like I do) is not supported. I've actually saved many older versions of the utility, even for the original Graphite (flying saucer) bases.]
  Post a comment  •  Comments (12)  
  • Currently 2.47 / 5
  You rated: 2 / 5 (19 votes cast)
 
[14,087 views] Email Article To a Friend View Printable Version
Fix dropout problems when streaming music over Airport Express g Network
I've been using Airport Express wireless-g for years to stream music to my stereos. And they work great once you get them working, but with the wireless-g models, I have always had problems setting them up on a new network after they have already been setup on another network. I use it as a streaming device, so it is set up as a device on my network, and not as my router. The problem with dropouts when streaming music over an Airport Express g can be resolved by changing the network settings on the wireless router.

First of all, the Airport Utility never seems able to find an Airport Express that does not have factory settings and is not set to communicate with the existing wireless network. Sometimes holding down the reset button on the AE until the light blinks rapidly while it is plugged in works. In other cases, I have had to hold it down before plugging it in and then plug it in to get it to work. I have often had to repeat these steps multiple times before I can get the Airport Utility to recognize it. It takes persistence, but eventually the Airport Utility will recognize it.

Once it is recognized, the setup is straight-forward. However, every time I set one up, I seem to forget about the dropout issues. I've found that dropouts occur when the network router wireless settings allow for both TKIP and AES security protocols (on a WPA security setting). I've found that by changing my router wireless settings to either TKIP or AES, but not allowing the use of both, the dropouts no longer occur.

Hope this works for people, as I love the AE's once they work. Just got a new wireless-n AE, and it seems some of the issues may have been resolved.

[crarko adds: I remember seeing some of these issues with the older AirPort Express as described here. I thought they were fixed with firmware updates, but I'm not absolutely sure. This sounds worth trying if you still have the dropout problem.]
  Post a comment  •  Comments (10)  
  • Currently 4.00 / 5
  You rated: 2 / 5 (11 votes cast)
 
[29,900 views] Email Article To a Friend View Printable Version
10.7: Mount AFP volume with root bug Network
I'm sick of waiting for Apple to come up with a fix to trying to mount a volume in 10.7 while logged in as root so I came up with my own solution.
cat >/tmp/mountVolume.sh <<-"EOF"
osascript -e 'mount volume "afp://username:password@server/path/"'
EOF
chmod 755 /tmp/mountVolume.sh
su -l guest /tmp/mountVolume.sh
rm -f /tmp/mountVolume.sh
When run as root this will use the guest account to mount the volume -- it's a work around and only recommended for those whom understand the root account.

[crarko adds: I haven't tested this one.]
  Post a comment  •  Comments (13)  
  • Currently 3.00 / 5
  You rated: 3 / 5 (12 votes cast)
 
[4,843 views] Email Article To a Friend View Printable Version
10.7: Slowdown with a new MobileMe/iCloud Password Network
My Mac started working extremely slowly and I couldn't understand the reason for a while.

I knew my wireless was working seemingly without problems (iPad and iPhone working normally) but I thought to run the AirPort Utility to check out the wireless network.

My AirPort Extreme was reporting a problem. It turns out that I had changed my password on MobileMe to match iCloud, and of course my AirPort Extreme did not know that. It was trying to connect to the MobileMe servers with no success. I guess it was trying to connect to MobileMe non-stop and it was slowing down my system significantly. Fixing the password within the AirPort Extreme resolved the issue.

[crarko adds: It's always worth looking at network related issues when an unexpected slowdown happens. And when a transition happens (like the Mobile Me -> iCloud migration) expect to see issues like this happen. Fortunately they're easy to correct once identified.]
  Post a comment  •  Comments (1)  
  • Currently 3.11 / 5
  You rated: 4 / 5 (9 votes cast)
 
[4,525 views] Email Article To a Friend View Printable Version
Getting port mappings and DHCP usage from an Airport Device Network
If you're like me, I'm frustrated by the way the Airport Utility displays NAT port mappings and DHCP assignments. I have a lot of ports mapped, and quite a few devices on my network and it's painful to remember which ports are mapped to which devices. I've searched high and low to find something to help and come up blank.

I wrote the following bash script which relies on the built-in utility PListBuddy to extract the relevant values from the property list that can be exported from the Airport Utility. To use it, open Airport Utility and select the device that has the mappings.

Press the 'Manual Setup' button (or Cmd+L) and the Utility will load the information from the device. Next choose Export Configuration File... from the file menu and save it to disk. Now run the bash script below and it will extract the values and send them to stdout in tab delimited form. You can then open the result in a spreadsheet or editor of your choice and see all your port mappings, DHCP assignments, known MAC addresses, current leases, and a snapshot of your network's performance.

It's isn't particularly pretty as I'm not a skilled bash writer, and someone with AppleScript expertise could do a much finer job. I'm always open to suggestions on how to do this. The hardest part is that there are no associative arrays in the version of bash that comes with OS X, so I had to do a lot of hashing and evals to create variables. Hope this proves useful and all comments and improvements are welcome.

Here's the script:
#!/bin/bash

##############################################################################
# Airport Configuration Reader
#
# This script processes the xml exported by the Airport Utility to produce a
# tab or comma delimited file containing the DHCP assignments, NAT port 
# mappings, and a snapshot of the outstanding leases and performance of the
# wireless clients at the time the file was exported.  The file is suitable
# for opening in excel or a text editor, where it can be formatted at will.
#
# It relies on the presence of the utility PlistBuddy, normally shipped with
# OS X, and displays an error message if it cannot find it.
#
# To use it, run the Airport Utility, select Manual Setup (command-L) and then
# File | Export Configuration to save the file on your disk.  Then run this
# script against it.
#
# This has only been really tested on my Airport Extreme, which is a dual N.
# Unfortunately your mileage may vary as I don't have any other devices...
#
# Questions, bugs, suggestions, improvements: dan at gerrity dot org.
#
# $Source: /Users/dan/bin/RCS/apt2tsv-v $
# $Date: 2011-12-26 17:27:21-08 $
# $Revision: 1.12 $
#
###############################################################################

###############################################################################
# Variable and default definitions
#
# Default text item delimiter is a tab, the -c switch can be used for comma
# delimited.  Note that string quoting is not provided so if names have quotes
# in them, the comma delimited version may not format exactly right.

declare -a res maps leases perf
me=$(basename $0)
delimiter="\t"
kma="${HOME}/.knownmacaddresses.$(date "+%Y-%m-%d_%H.%M")"
rev="$(echo '$Revision: 1.12 $' | sed -e 's/\$//g' -e 's/ $//' -e 's/R/r/')"


###############################################################################
# Functions
###############################################################################

function usage() {
    [[ ${1} ]] && echo -e "Configuration file \"${1}\" could not be found.\n" 1>&2
    echo -e "${me} ${rev}\n" 1>&2
    echo -e "Usage: ${me} [-c] configuration[.baseconfig]\n" 1>&2
    echo -e "Option -c creates comma delimited files instead of tab delimited.\n" 1>&2
    echo "Using the AirPort Utility, select the device for which you want information, and" 1>&2
    echo "then press the \"Manual Setup\" button.  Once the configuration is loaded, use" 1>&2
    echo "the File | Export Configuration File... to save the configuration to disk." 1>&2
    echo -e "Use that file as the argument to the script.\n" 1>&2
    exit 1
}

function checkForPlistBuddy() {
    plb=$(which PlistBuddy)
    [[ (! ${plb}) && (-e /usr/libexec/PlistBuddy) ]] && plb="/usr/libexec/PlistBuddy"
    [[ ${plb} ]] && return
    echo "PlistBuddy is an application provided by Apple that processes plist files."
    echo "${me} relies on PListBuddy and it is neither in your path nor in the normal location"
    echo "/usr/libexec/PlistBuddy."
    exit 2
}

function getConfigFile() {
    filepath="${1}:./${1}:./${1}.baseconfig"
    filepath="${filepath}:${HOME}/${1}:${HOME}/${1}.baseconfig"
    filepath="${filepath}:${HOME}/Downloads/${1}:${HOME}/Downloads/${1}.baseconfig"
    filepath="${filepath}:${HOME}/Desktop/${1}:${HOME}/Desktop/${1}.baseconfig"
    oIFS="${IFS}"
    IFS=":"
    for fpn in ${filepath}; do
	if [[ -e "${fpn}" ]]; then cf="${fpn}"; break; fi
    done
    IFS="${oIFS}"
    [[ ! -e "${cf}" ]] && usage "${cf}"
}

# This function makes a poor-man's lookup table (no associative arrays in bundled bash) between
# MAC address, IP address, and host name.  
# Takes an environment variable name prefix, an address, and a description
function mungAddr() {
    munged="${1}$(echo ${2} | sed -e 's/\./x/g' -e 's/:/x/g')"
    shift; shift
    eval "${munged}=\"$*\""
}

# Creates a 12 digit number for the IP address that is sortable
function ipSort() {
    printf "%03s%03s%03s%03s" $(echo ${1} | sed 's/\./ /g')
}

# Gets some name and model parameters
function setName () {
    n1=$(${plb} -c "print auNN" "${cf}")
    [[ ${n1} ]] && name="${n1}"
    n2=$(${plb} -c "print syDN" "${cf}")
    n3=$(${plb} -c "print syAM" "${cf}")
    if [[ (${n1}) && (${n2}) ]]; then
	[[ "${n1}" != "${n2}" ]] && name="${n1}/${n2}"
    else
	[[ (${n1}) || (${n2}) ]] && name="${n1}${n2}"
    fi
    [[ (${name}) && (${n3}) ]] && name="${name}, ${n3}"
}

# Reads the DRes key to obtain dhcp reservations, also links machine name to IP and MAC addresses
function getReservations() {
    resTitle="|Description|IP Address|MAC Address|Type"
    numres=$(${plb} -c "print DRes:dhcpReservations:" "${cf}" | grep Dict | wc | awk '{print $1}')
    for (( i=0; i<${numres}; i++ )); do
	eval $(${plb} -c "print DRes:dhcpReservations:${i}" "${cf}" | grep "=" | \
	    sed -e 's/type/etype/' -e  's/[[:space:]]*\(.*\) = \(.*\)$/\1="\2"/')
	macAddress=$(echo ${macAddress} | tr "[A-F]" "[a-f]")
	mungAddr "i2h" "${ipv4Address}" "${description}"
	mungAddr "m2h" "${macAddress}"  "${description}"
	mungAddr "m2i" "${macAddress}"  "${ipv4Address}"
	res[ i ]="$(ipSort ${ipv4Address})||${description}|${ipv4Address}|${macAddress}|${etype}"
    done
}

# Reads the NAT address translations
function getMaps() {
    mapTitle="|Description|Destination|Host|TCP Public|UDP Public|TCP Private|UDP Private|"
    mapTitle="${mapTitle}Service Type|Service Name|Advertise|Enabled"
    nummaps=$(${plb} -c "print fire:entries:" "${cf}" | grep Dict | wc | awk '{print $1}')
    for (( i=0; i<${nummaps}; i++ )); do
	dest=$(${plb} -c "print fire:entries:${i}:hosts:0" "${cf}")
	hname="i2h$(echo ${dest} | sed 's/\./x/g')"
	[[ "${!hname}" == "" ]] && host="** NO DHCP **" || host="${!hname}"
	eval $(${plb} -c "print fire:entries:${i}" "${cf}" | grep "=" | grep -v hosts | \
	    sed -e 's/[[:space:]]*\(.*\) = \(.*\)$/\1="\2"/' -e 's/true/yes/g' -e 's/false/no/g')
	maps[ i ]="$(ipSort ${dest})||${description}|${dest}|${host}|${tcpPublicPorts}|${udpPublicPorts}|${tcpPrivatePorts}|${udpPrivatePorts}|${serviceType}|${serviceName}|${advertiseService}|${entryEnabled}"
    done
}

# Reads the outstanding leases at the time the export was made.
function getLeases() {
    leaseTitle="|Host|IP Address|MAC Address|Lease Ends"
    numleases=$(${plb} -c "print dhSL:leases:" "${cf}" | grep Dict | wc | awk '{print $1}')
    for (( i=0; i<${numleases}; i++ )); do
	eval $(${plb} -c "print dhSL:leases:${i}" "${cf}" | grep "=" | \
	    sed 's/[[:space:]]*\(.*\) = \(.*\)$/\1="\2"/')
	macAddress=$(echo ${macAddress} | tr "[A-F]" "[a-f]")
	leases[ i ]="$(ipSort ${ipAddress})||${hostname} (lease)|${ipAddress}|${macAddress}|${leaseEnds}"
    done
}

function getPerformance() {
    perfTitle="|Description|IP Address|MAC Address|Signal|Noise|Rate|Mode"
    let perfEntries=0
    numRadios=$(${plb} -c "print raSL" "${cf}" | grep "wlan.*" | wc | awk '{print $1}')
#   for some reason the wlan entries are sparse, so just from from 0 to 9    
#   for (( rad=0; rad<${numRadios}; rad++ )); do
    for (( rad=0; rad<9; rad++ )); do
	numClients=$(${plb} -c "print raSL:wlan${rad}" "${cf}" 2> /dev/null | grep "macAddress" | wc | \
	    awk '{print $1}')
	for (( j=0; j<${numClients}; j++)); do
	    eval macAddress=\"$(${plb} -c "print raSL:wlan${rad}:${j}:macAddress" "${cf}" 2> /dev/null | \
		tr [A-F] [a-f])\"
	    for term in rssi noise txrate phy_mode; do
		eval ${term}=\"$(${plb} -c "print raSL:wlan${rad}:${j}:${term}" "${cf}" 2> /dev/null)\"
	    done
	    mip="m2i$(echo ${macAddress} | sed 's/:/x/g')"
	    [[ ${!mip} ]] && ip=${!mip} || ip="0"
	    mdesc="m2h$(echo ${macAddress} | sed 's/:/x/g')"
	    [[ ${!mdesc} ]] && desc=${!mdesc} || desc="unknown"
	    perf[ (( perfEntries++ )) ]="$(ipSort ${ip})||${desc}|${ip}|${macAddress}|${rssi}|${noise}|${txrate}|${phy_mode}"
	done
    done
}

function printResults() {
    echo "Airport Data taken from $(basename ${cf}) [${name}] on $(date)"; echo
    echo "DHCP RESERVATIONS IN $(basename ${cf}) [${name}]"
    echo ${resTitle} | tr "|" "${delimiter}"
    printf "%s\n" "${res[@]}" | sort | cut -f2- -d'|' | tr "|" "${delimiter}"; echo
    echo "DHCP LEASES IN $(basename ${cf}) [${name}]"
    echo ${leaseTitle} | tr "|" "${delimiter}"
    printf "%s\n" "${leases[@]}" | sort | cut -f2- -d'|' | tr "|" "${delimiter}"; echo
    echo "NAT PORT MAPPINGS IN $(basename ${cf}) [${name}]"
    echo ${mapTitle} | tr "|" "${delimiter}"
    printf "%s\n" "${maps[@]}" | sort |  cut -f2- -d'|' | tr "|" "${delimiter}"; echo
    echo "PERFORMANCE SNAPSHOT IN $(basename ${cf}) [${name}]"
    echo ${perfTitle} | tr "|" "${delimiter}"
    printf "%s\n" "${perf[@]}" | sort | cut -f2- -d'|' | tr "|" "${delimiter}"; echo
}

function printKnownMacAddresses() {
    echo "MAC ADDRESSES"
    for (( i=0; i<${#res[@]}; i++ )); do
	echo "${res[ i ]}" | sed 's/.*\|\(.*\)\|.*\|\(.*\)\|.*/\2 \1/' >> "${kma}"
    done
    for (( i=0; i<${#perf[@]}; i++ )); do
	echo "${perf[ i ]}" | sed 's/^.*\|\(.*\)\|.*\|\(.*\)\|.*\|.*\|.*\|.*$/\2 \1/' >> "${kma}"
    done
    sort "${kma}" | uniq > "${kma}.tmp" && mv "${kma}.tmp" "${kma}"
    lastmac=""
    line=""
    cat "${kma}" | while read mac rol; do
	if [[ ${mac} == ${lastmac} ]]; then
            line="${line}/${rol}"
	else
            [[ ${line} ]] && echo "$(echo ${line} | tr "|" "${delimiter}")"
            line="${mac}|${rol}"
            lastmac=${mac}
	fi
    done
}

###############################################################################

[[ ! ${1} ]] && usage

if [[ "${1}" == "-c" ]]; then
    delimiter=","
    shift
fi

while [[ "${1}" ]]; do
    getConfigFile "${1}"
    checkForPlistBuddy
    setName
    getReservations
    getLeases
    getMaps
    getPerformance
    printResults
    shift
done
printKnownMacAddresses

[crarko adds: There are a couple of steps missing above. First, copy and paste the script to a text file and save it (I named mine 'airport_addr.sh'). I save it to my Desktop along with the exported Airport configuration file (named 'AC_Extreme.baseconfig' in my case). Then I opened Terminal and typed cd Desktop so the working directory is where the files are located. I made sure the script was executable by typing chmod +x airport_addr.sh.

To run the script I typed (use the actual names of your files instead of mine):

./airport1.sh AC_Extreme.baseconfig

The results displayed in the Terminal window. You'll probably want to redirect the output to a file to permanently capture the data, or you can just copy and paste the results from Terminal.]
  Post a comment  •  Comments (6)  
  • Currently 2.25 / 5
  You rated: 5 / 5 (4 votes cast)
 
[5,041 views] Email Article To a Friend View Printable Version
10.7: Hidden Mobile Network Profile support Network
Opening a .mobileconfig file in Lion exposes an otherwise hidden System Preference, 'Profiles' as shown here.

The .mobilconfig files are typically used to manage network settings on iOS, including the Access Point Name (APN).

To view this in Lion, just open a .mobileconfig file from Finder and System Preferences will now reveal 'Profiles' with a means to manage multiple profiles.

If you install a .mobileconfig, Profiles will remain available in System Preferences; if you delete all profiles, then Profiles no longer appears in System Preferences.

This doesn't yet seem to affect network access or browsing at all, so it is possible this feature exists to pave the way for more unified management of APN on desktops with mobile internet access, similar to iOS. You saw it here it first!

[crarko adds: I think the point of this is to indicate possible future support of cell networks in OS X, perhaps on a future MacBook Air. It doesn't seem to have any immediate utility.]
  Post a comment  •  Comments (12)  
  • Currently 2.80 / 5
  You rated: 5 / 5 (5 votes cast)
 
[13,118 views] Email Article To a Friend View Printable Version