Sign up ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

On Lion and iCloud, the old MobileMe and Snow Leopard mDNS naming has changed and no longer works.

I'm wondering how to use command line tools to find out the DNS name that Apple has assigned to my Mac. I want to use that dns name on other devices that are not OSX (like Prompt on my iPad/iPhone) to ssh back to my Mac when I'm out and about.

share|improve this question

3 Answers 3

up vote 25 down vote accepted


There's a very simple way to simply SSH to a BTMM/iCloud computer:

In Terminal, in the Shell menu select New Remote Connection... (cmd+shift+K). From here you can browse by ssh/sftp/ftp/telnet hosts on the local or BTMM network.

This is obviously much easier for the individual apps that support iCloud/BTMM lookup (e.g. you'll also see file shares in the side-bar of Finder, and remote Airport devices in Airport Utility), but I'll leave the full instructions below for the more arbitrary use-cases.

For command line tools, Apple have replaced the old <computer-name>.<mobileme-name>, with <computer-name>.<numeric-id> (where the <numeric_id> field is a number automatically generated for your Apple ID).

Step 1: Find out your iCloud BTMM domain

First, look up your domain using the DNS Service Discovery tool:

# dns-sd -E

The output is formatted slightly awkwardly, but what you're after is the numeric ID, which should be on the last line. You're after the full domain, something like, however dns-sd will display it (kind of) in reverse order, on separate lines:

23:41:33.309  Added                
                                             - > btmm
                                             - - > members
                                             - - - > 12345678

You'll also need to press ctrl+C after it displays the information you're after (it is designed to continue listening and updating). This applies to each use of dns-sd, here and below.

Step 2: List Computers

You can use these tools to browse that domain for services, e.g. for ssh servers:

# dns-sd -B _ssh

Or if you already know the hostname just access it directly as (Any spaces in your computer name will be hyphens in this domain).

You can only access this from a computer that is also set up for BTMM on the same Apple ID account, because this hostname will resolve to an IPv6 address that is really the end of an encrypted network tunnel between your Apple ID's BTMM computers.

If you want to see the IPv6 address for a specific host, you can type

# dns-sd -G v6

And it'll display something like:

17:37:47.504  Add     2  0 FD11:993E:64AE:4DEA:011F:FBD1:F444:11A1%<0>  152

Step 3: Connect

# ssh


I'm not sure if that number will ever change, so you may or may not need to repeat Step 1 at some point later on... mine's been static for quite a few years now.

share|improve this answer

This isn't my preferred method, but the Terminal app also polls your iCloud account for all Back To My Mac computers that it has a current registration.

Under the Shell menu - New Remote Connection... ++K

This is quite handy to set up a new ssh/sftp connection home when you are not on the local internet or your dns server won't look up the AAAA records that match your current domain reservation.

share|improve this answer
What if the computer name has spaces? That seems to muck everything up D: –  AMomchilov Dec 23 '13 at 16:52
replace the spaces with dashes. Example: "Work iMac" would be "Work-iMac" –  Michael Irey Apr 9 '14 at 20:53
This is useful. even gives you the resulting ssh command which you can then paste into iTerm or whatever you actually use. –  jogloran Jul 21 '14 at 11:50

Here's the answer to your question…

I just learned a nifty way to find your BTMM domain name

echo show Setup:/Network/BackToMyMac | scutil | sed -n 's/.* : *\(.*\).$/\1/p'

source: by skyisle

But here's why that still doesn't help you…

However, note that even if you know the BackToMyMac domain, you can only use it if you are connecting from a computer that is connected also logged into 'BackToMyMac'. It will not work directly via Prompt.

(I believe Apple considers this a security-related feature. Otherwise anyone on the Internet could try to gain access to your Macs if they knew the BTMM domain name.)

There are other sites on the web which will do dynamic DNS hosting for you. I've used DynDNS for years, but they have gotten more and more commercially focused (used to be able to get 5 free dynamic hostnames, now it's 1, and you can only get that one by giving them a credit card number and trying out one of their premium services and then canceling it).

I have not used but they have a Mac update client too (which will automatically update whenever your Mac's IP address changes) and they will give you three free hostnames if you create a free account (no credit card info needed).

Note that this doesn't work as easily as BTMM because you still have to make sure that you have open ports on your router, etc. However, it will work with Prompt and from other hosts.

share|improve this answer
You have nailed the nail on the head with the proviso that currently a Mac is required to use BTMM on both ends. –  bmike Jun 17 '12 at 23:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.