Forum Xamarin.iOS


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Mac Agent Not Working - Can't Connect

WednesdayWolfWednesdayWolf USMember
edited November 2015 in Xamarin.iOS

I updated everything to 4.0 today. I can see my Macbook using the Mac Agent - but when entering my credentials, the following error is given:

Couldn't connect to [Mac Name].local. Please try again

I have followed every step of the troubleshooting guide:

Here is what I know:

  • I am using the correct username, verified with whoami
  • I am using the correct password
  • Mac Agent is using the correct IP address for my macbook
  • I have updated every component, on each machine, to the latest release - they're all on the Stable channel
  • Port 22 is open, as ensured by a custom rule in inbound/outbound for Windows Firewall
  • I can ping my macbook
  • I can ssh to my macbook, using port 22, using Putty

Odd things:

  • Library/Caches/Xamarin/ does not exist


  • Same problem here... have you managed to figure it out?

  • JeffGonzalesJeffGonzales USMember ✭✭

    After updating both my Windows and Mac machines, I was able to connect with the Mac Agent a few times. Then suddenly it wouldn't work anymore. I rebooted both machines and now I am stuck trying to select a Mac to use as an agent. The choose agent dialog shows a waiting icon and a disabled "Connect" button despite a right-click on my agent computer indicating that I am connected. Any ideas?

  • JeffGonzalesJeffGonzales USMember ✭✭

    I'll have to try that next. After rebooting (again), I chose "disconnect" and then reconnected. That appears to have solved it. Unfortunately now, every time I start Visual Studio I get the dreaded "Microsoft Visual Studio is Busy" pop-up notification.

  • @SheppePharis said:
    What I did to fix it was choose to manually add a Mac, and entered the Mac’s IP address. It was able to connect to it immediately and it seems to be functioning as expected.

    I attempted that - it resulted in an identical error. What's curious is that I'm able to establish a ssh connection with my mac by other means.

    I've started a thread on bugzilla:

  • ciani.afonsociani.afonso USUniversity ✭✭

    @WednesdayWolf I have the same problem, I can connect through ssh but the agent never connected :neutral:

  • @WednesdayWolf I was also able to SSH over to my Mac from my Windows Xamarin box.

    A ticket I was referred to by Xamarin support is It didn't apply to my problem, but perhaps it does to yours (the situation in the ticket being the Mac is not connected to the internet). The workaround is to add the following line on the Mac to /etc/sshd_config:

    UseDNS no

  • @SheppePharis Curious! No doubt useful to others. Doesn't apply to this situation, unfortunately - both machines are connected to the internet.

  • ciani.afonsociani.afonso USUniversity ✭✭

    @WednesdayWolf I just get the agent to connect to my Mac. You need to activate the firewall on your Mac and allow the connection. It makes no sense but this has worked for me.

  • Jan.NeprasJan.Nepras USMember ✭✭

    @JeffGonzales I had the the same problem - Visual Studio is busy. I opened the project in Visual Studio 2013 and then reopen in Visual Studio 2015. It's funny, but it worked for me.

  • JeffGonzalesJeffGonzales USMember ✭✭

    That worked for me a couple of times, but then I started to get the problem back. If I revert to my original project in SVN it starts to work again. I wonder if Xamarin is corrupting some project files...

  • WednesdayWolfWednesdayWolf USMember
    edited November 2015

    @ciani.afonso Just tried that out - the mac was able to recognise that a ssh connection was attempting to be established. It brought up the mono-sgen prompt. I allowed the connection, and the same error message occurred in Visual Studio. "Couldn't Connect. Please try again."

  • ciani.afonsociani.afonso USUniversity ✭✭

    @WednesdayWolf Yes, I allowed that connection to mono-sgen, and it worked.

    What version of OS are you using?
    I'm using version El Capitan, in Yosemite version I did not get it to work.

  • KMullinsKMullins USMember, Xamarin Team Xamurai


    For those having issues connecting with the Mac Host Agent, please try the following:

    You need to ensure that both IDEs (Xamarin Studio on the Mac, and Visual Studio on windows) are on the same updater channel, as mentioned here and you can also use the Connectivity Troubleshooting guide to double check everything else is set up properly.

  • WednesdayWolfWednesdayWolf USMember
    edited November 2015

    @ciani.afonso Trying to connect to a 10.11 (El Capitan) machine.

    @KMullins They're both on the same channel, and as I said in my opening post I've followed every step of that guide.

  • AndrewNikAndrewNik UAMember ✭✭

    Hi guys! I'm facing the same problem. Update channels are the same, both updated to latest version, tried enabling firewall on Mac, allowed a connection for mono-sgen, tried to connect manually with IP address, but nothing helped. Both computers are connected to same router with Internet connection, I can connect to my Mac via SSH with Putty, remote login is enabled for my user.

  • IvanToledoIvanToledo CLUniversity ✭✭

    I'm having the exact same issue, can't connect to my mac. Worked fine with build server. SSH connection works with putty, so it's not a configuration problem.

  • Same here.

    I've found this messages in the VS Log:
    Xamarin.Messaging.VisualStudio.MessagingService+UploadFileLogger Information: 0 : [2015-11-22 13:18:00.1266] Uploaded Broker 100% Xamarin.Messaging.Client.Ssh.XmaCommands Warning: 0 : [2015-11-22 13:18:01.0437] Checksum failed for '/Volumes/Macintosh HD/Users/markus/Library/Caches/Xamarin/XMA/Broker/' Xamarin.Messaging.VisualStudio.MessagingService Error: 0 : [2015-11-22 13:18:01.0517] Unable to install the Broker

  • ClintonLandryClintonLandry USUniversity
    edited November 2015

    Same problem. Mac Agent worked for a couple of days and now I cannot connect. Tried most of what was suggested here to no avail on El Capitan / Win 10 / VS 2015 both Xamarin's on latest stable. Worked fine on build host, can get ssh key, sometimes the broker installs but I never get a full connection. Logs indicate cannot start broken host disconnected as mentioned above.

    Xamarin.Messaging.VisualStudio.MessagingService Information: 0 : [2015-11-24 15:09:11.1684] MacServer State transition from AgentsStartingState to LimitedState on Publishing-Mac.local (
    Xamarin.VisualStudio.IOS.Messaging.State.DisconnectedState Information: 0 : [2015-11-24 15:09:11.2580] Connected to the Mac Publishing-Mac.local ( with Limited support.
    Xamarin.Messaging.Client.MessagingClient Error: 0 : [2015-11-24 15:09:18.9032] An error occured on client vs7512Clint while executing a post for topic xma/ping/Broker4001689
    System.TimeoutException: The operation has timed out.
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
    at Xamarin.Messaging.Client.MessagingClient.d__2`2.MoveNext()
    Xamarin.Messaging.VisualStudio.MessagingService Information: 0 : [2015-11-24 15:09:19.0348] MacServer State transition from LimitedState to DisconnectedState on Publishing-Mac.local (
    Xamarin.VisualStudio.IOS.Messaging.State.ServerStateContext Information: 0 : [2015-11-24 15:09:19.1219] The underlying client has been closed
    Xamarin.Messaging.VisualStudio.MessagingService Information: 0 : [2015-11-24 15:09:19.2089] Disconnected from Mac Publishing-Mac.local (
    Xamarin.VisualStudio.IOS.MacServer Error: 0 : [2015-11-24 15:09:21.3258] An error occured starting the IDB agent: Client not connected.

  • Im having the same problem. I can connect through SSH but in Visual Studio it says it can't connect to mac host.

  • ClintonLandryClintonLandry USUniversity

    Turns out my issue was related to timeouts caused by internal network issues.

  • AndrewNikAndrewNik UAMember ✭✭

    @ClintonLandry said:
    Turns out my issue was related to timeouts caused by internal network issues.

    Did you try to connect to Mac via SSH directly? Because I can connect directly without any issues, but Xamarin keeps giving me "can't connect" error

  • ClintonLandryClintonLandry USUniversity

    @AndrewNik have you read the logs (Help > Xamarin > Logs) to get a better understanding of why? It clearly told me my session was timing out while uploading the IDB agent to the mac. A speed test or two later made it clear what a possible cause was for me and after that was resolved it works perfectly fine on latest stable, Win10/VS15 to El Capitan.

  • AndrewNikAndrewNik UAMember ✭✭

    @ClintonLandry I found such info there, and that looks really strange

    Xamarin.Messaging.VisualStudio.MessagingService Information: 0 : [2015-11-25 17:20:23.0305] Starting Broker in port 51316...
    Xamarin.Messaging.Client.Ssh.SshCommandRunner Warning: 0 : [2015-11-25 17:20:23.2113] Failed to execute 'ls /usr/bin/mono': ExitStatus=1
    Xamarin.Messaging.Client.Ssh.SshCommandRunner Warning: 0 : [2015-11-25 17:20:23.3113] /Users/andreynikolin/.bashrc: line 1: No such file or directory
    ls: /usr/bin/mono: No such file or directory

    Xamarin.VisualStudio.IOS.Messaging.State.DisconnectedState Error: 0 : [2015-11-25 17:20:23.5331] Couldn't connect to MacBook-Pro-Andrey.local. Please try again.
    Xamarin.VisualStudio.IOS.Messaging.State.DisconnectedState Information: 0 : [2015-11-25 17:20:23.6642] MacServer State transition from SshConnectingState to DisconnectedState on MacBook-Pro-Andrey.local (
    Xamarin Information: 0 : [2015-11-25 17:20:23.8128] Disconnected from Mac MacBook-Pro-Andrey.local (

    I've checked, such directory doesn't exist on my Macbook and I'm curious where I have to get it

  • ClintonLandryClintonLandry USUniversity


    I was getting those errors as well but it was just noise resulting from my PC not getting everything it needed onto the MAC before a disconnect happened.

    Along with my office wifi not being under construction anymore I did follow suggestions above including turning the MACs firewall on and allowing mono-sgen. Followed all of the steps in the Connectivity Troubleshooting link above as well.

  • AndrewNikAndrewNik UAMember ✭✭

    @ClintonLandry I'm working with this set-up at home, there are only 2 computers on the network, so I don't think the problem can be in connection between them. Firewall is enabled as well(allowed connection), and I've already tried all steps from troubleshoot guide. Just tried manually reinstalling Mono, but that didn't help.

  • I solved my problem by changing to Alpha channel.
    This was the same bug that was happening to me:
    My Windows username has a "~" and it was raising an exception. Hope this can help someone

  • JohnWilson.4976JohnWilson.4976 AUMember ✭✭

    Mine had been behaving for days (I upgraded to v4 last Friday) until I started fiddling with the internet connectivity for the ios simulator by turning my wifi on and off yesterday afternoon. It was running through a wifi hotspot tether thru my mobile phone.

    After suspending/resuming my macbook (at home, on a different wifi network), VS refused to connect to the mac agent. I tried rebooting, restarting the windows VM in paralyse... I mean Parallels... no dice. The IP address of the mac host as far as my parallels instance was concerned, hadn't changed, but the internal IP address of the mac itself had, because it had connected to different wifi router, different network (192.x as opposed to 10.x).

    For a while the indicator on VS looked like it had a connection to the mac agent, but I had no ios devices listed in the dropdown for the simulator. I couldn't disconnect it (there's no button) and I couldn't refresh it (there's no button). After several restarts of VS, I was finally prompted with the mac agent connection dialog. It said it could see the mac agent on mac-host-name.local, but refused to connect to it, exactly as described ad nauseum in this thread.

    I noticed it also took frikkin age to "get the ssh fingerprint" (where normally this takes less than a second).

    And it kept telling me my login was incorrect.

    I was still able to ssh and log in to the mac host at the IP address it had for the agent (also via putty), no problem. Firewalls, blah, exactly the same as everyone else here.

    Over an hour later of banging my head on this, I ended up adding the 'UseDns=No" flag as mentioned above, and killing and restarting sshd on the mac. That didn't seem to solve the problem, but after restarting VS for the squillionth time, and getting the mac agent connection dialog back, I added a new mac, using the IP address it's always used (instead of mac-host-name.local). It took less than a second to get the ssh fingerprint, and logged me in immediately with the same credentials it's always asked for.

    At that point I was so damn glad it was working again that I let it be, and carried on. Of course I had to work for over an hour longer than I had planned to make up for the time I'd lost, which meant I only got to bed at 1am.

    Not cool.

    But when I got back on the train this morning (after suspending the macbook last night and resuming everything this morning), it prompted me to log in again. I got a sinking feeling, coupled with not a small amount of cold rage... but on a hunch, I told it to connect to the mac-host-name.local (instead of the IP address) and it worked. Straight in, no complaints, didn't even ask me for my login.

    My gut tells me that it's all got to do with the wifi network connectivity coming and going. Perhaps IP addresses of the host machine changing as they come and go. Maybe it confuses the ssh daemon or breaks the agent, something like that.

    This reminds me a lot of the same issues I used to get with the previous mac build host, during my daily commutes, where VS would not quite randomly lose the connection to the build host when the 3G/wifi hotspot tether through my phone lost the internet connectivity because I was going through a 3G/4G coverage dead spot. I'd lose internet connectivity, and then within a few seconds I'd get that error about "another instance of visual studio is using the build host" error (when there was only one instance running).

    I noticed at one point during the trip home yesterday (when going through one of those dead spots) that VS had apparently still got a the connection to the mac agent, but all the simulator devices disappeared from the dropdown. Restarting VS fixed the problem tho.

    Maybe this helps someone as well. Maybe it adds a couple more clues to why this is happening.

    Rage and despair aside, I think this mac agent is SO much better than what we had before. I think that's why I got annoyed with it so quickly when it broke, because it Just Worked, and I'd already grown used to not having to disconnect/reconnect to the mac build host again and again on my trips home on the train or bus (sometimes 2-3 times in an hour).

  • AndrewNikAndrewNik UAMember ✭✭
    edited November 2015

    Xamarin.Messaging.Client.Ssh.SshCommandRunner Warning: 0 : [2015-11-25 17:20:23.2113] Failed to execute 'ls /usr/bin/mono': ExitStatus=1

    Finally, looks like I found out why this happened. El Capitan restricts software installation to /usr/bin, so Mono is installed to /usr/local/bin. I think Xamarin development team has to change paths where Xamarin for VS is looking for Mono. Another way to fix this is described here
    I tried creating symlink in /usr/bin, but system doesn't create it even using sudo, so it looks like I'll have to disable this system protection using the info from the link above. Or wait for fix from Xamarin.
    Some more info - you can make mono execute in terminal with the following command

    export PATH=/Library/Frameworks/Mono.framework/Versions/Current/bin/:${PATH}

    But Xamarin for VS executes it directly with /usr/bin/mono and that causes the problem.
    Mentioning @KMullins check this information, please

  • JsinhJsinh INUniversity ✭✭

    I am stuck at the same place as @AndrewNik
    But have no clue how to handle this issue.

    With this issue using VS for XAMARIN dev. is no option anymore.

    Will reinstalling everything on MAC or resetting MAC and starting over again help?

    Followed answer on this link:
    and install Mono after csrutil disable but that does not help.

    Anyone any idea on how to fix it or any workaround or when the fix is coming?

  • AndrewNikAndrewNik UAMember ✭✭

    @Jsinh I haven't checked this method yet, will try later today

  • AndrewNikAndrewNik UAMember ✭✭

    So I've disabled csrutil, created symlink from /usr/local/bin/mono to /usr/bin, but it still doesn't want to work. Here is the log and now I can't see any clues in it

    Xamarin.VisualStudio.IOS.Messaging.State.ServerStateContext Information: 0 : [2015-11-26 22:10:40.3336] MacServer State transition from DisconnectedState to SshConnectingState on (
    Xamarin.Messaging.VisualStudio.MessagingService Information: 0 : [2015-11-26 22:10:42.8231] Starting Broker in port 57648...
    Xamarin.VisualStudio.IOS.Messaging.State.DisconnectedState Error: 0 : [2015-11-26 22:10:43.2284] Couldn't connect to Please try again.
    Xamarin.VisualStudio.IOS.Messaging.State.DisconnectedState Information: 0 : [2015-11-26 22:10:43.3158] MacServer State transition from SshConnectingState to DisconnectedState on (
    Xamarin.VisualStudio.IOS.Messaging.State.ServerStateContext Information: 0 : [2015-11-26 22:10:44.1991] Disconnected from Mac (

  • JohnWilson.4976JohnWilson.4976 AUMember ✭✭

    (I'm still on Yosemite, not upgraded to El C. yet; the only reason is because I know there's issues with getting Xamarin to run on it).

    However, I can confirm that the connectivity issue is directly related to the wifi networks I'm switching between. At the office (where I initially set this up), I have no problem connecting to the original mac.local address I was using when I am at the office.

    I can't connect to the second mac (same vm host, same IP) I created at home (as described in my earlier post) in the connection list (even tho it's by IP address) when I am at the office

    When I get home, it's the opposite. I can not connect to the one I was connected to earlier at the office, and can only use the second one I created when I was at home. When I try the one I would have been using earlier that morning, at the office, I get the red-tinted dialog, the long wait for the ssh fingerprint and eventually the "no connection for you! come back one year!"

    Frustrating, to say the least, but at least this solves the problem for me. Hopefully it'll help someone else too.

    My environment:

    Macbook Pro with OSX Yosemite 10.10.5. Firewall on.
    Parallels Desktop 10.2.2 (29105).
    Running VS 2013 update 4 on Windows 7 Ultimate inside a Parallels VM.

    Build Information
    Release ID: 510000871
    Git revision: 4e9c5abb5ffdae12ba02ac49da83f8b2011dbb88
    Build date: 2015-11-12 07:16:34-05
    Xamarin addins: 55007ed0e56436f385d8e26394a45be563abc7e8
    Build lane: monodevelop-windows-cycle6

  • AndrewNikAndrewNik UAMember ✭✭
    edited November 2015

    @JohnWilson.4976 So it may be possible, that if I connect both Mac and PC to my router via Ethernet everything will run smoothly?
    Update: Just checked, even via Ethernet connection Xamarin doesn't work with such log

    Xamarin.VisualStudio.IOS.Messaging.State.ServerStateContext Information: 0 : [2015-11-27 19:43:25.7047] MacServer State transition from DisconnectedState to SshConnectingState on (
    Xamarin.VisualStudio.IOS.Messaging.State.ServerStateContext Information: 0 : [2015-11-27 19:43:28.9690] MacServer State transition from SshConnectingState to DisconnectedState on (
    Xamarin.Messaging.VisualStudio.MessagingService Information: 0 : [2015-11-27 19:43:29.1020] Starting Broker in port 57582...
    Xamarin.VisualStudio.IOS.Messaging.State.ServerStateContext Information: 0 : [2015-11-27 19:43:29.2295] Disconnected from Mac (
    Xamarin.VisualStudio.IOS.Messaging.State.DisconnectedState Error: 0 : [2015-11-27 19:43:29.3690] Couldn't connect to Please try again.

  • AndrewNikAndrewNik UAMember ✭✭

    Another interesting thing I found is

    Xamarin.VisualStudio.IOS.Bonjour.BonjourDiscovery Information: 0 : [2015-11-27 19:42:59.2460] Bonjour service 'MacBook Pro - Andrey' did not respond with its IP address.

    Which appears before I try to establish connection

  • JsinhJsinh INUniversity ✭✭
    edited November 2015

    Got it working the hard way. I had to hard reset my MAC (did not have anything imp. on it so was easy to wipe it off).

    Reinstalled El Caption. Then installed Mono 32x / 64x from Official Mono Site. Then installed XCode. Then installed my certificates and provisioning profiles. Then installed XAMARIN.

    This time I try to connect my VS instance with MAC and viola it all worked. No delays in connection. No errors. No path error logs. Worked on WiFi to WiFi - WiFi to LAN - LAN to LAN.

    This should not be a solution but it worked.

    So now the MAC and VS on PC are connected - I am having other issue trying to run app on a real device connected to the MAC.

    Shows following error or log:
    "The application [blahblahblah] needs to be rebuilt due to an inconsistency between
    the connected Mac and the local app. Please rebuild the application and try

    Anyone who has clue of this issue?

  • JohnWilsonJohnWilson USMember

    @Jsinh I've seen that error when moving between different dev environments (mac and pc). I guess it builds them slightly differently. All I usually do is clean the solution and rebuild. Tho I think I often end up having to uninstall the app too, so it gets installed cleanly.

  • JohnWilsonJohnWilson USMember

    @AndrewNik I would have thought that would mean it would work, but maybe it's less about the wifi and more about what the agent is doing with changed network addresses. I'm still ping-ponging between the two separate "identities" I created in the list for the (same) mac depending on where I am. It's still a pita but I have no choice but to live with it until the xamarin guys (or someone with more linux-fu than me) can figure out why this is still a problem.

  • AndrewNikAndrewNik UAMember ✭✭

    @JohnWilson I can say you are lucky, because such solution(connecting directly to IP or to network name) doesn't work for me at all. For now I have no more clues how to fix this problem. And Xamarin support stoped replying:(

  • JohnWilsonJohnWilson USMember

    @AndrewNik that really sucks, man. I know I'm one of the lucky ones. And I am expecting it to break any time, and completely lock me out of my mobile development. my employer will NOT be amused when that happens.

Sign In or Register to comment.