Darko Fabijan wrote this on October 17, 2011
How to solve the losing X11 connection problem with VirtualBox on Mac OS Lion
We all know that today you cannot get a better desktop operating system than Mac OS. Together with great Apple hardware the bundle is an unbeatable desktop platform. But everybody in our team has been sailing with Linux for almost a decade and we still prefer it as a development platform. Paired with isolation that VirtualBox provides we just feel like at home in our Linux + VirtualBox development boxes.
Since we upgraded to Lion we got scared for a sec that we will have to leave VirtualBox + Linux behind because we just couldn’t solve an issue of losing X11 connection, which is of corse key for running Cucumber scenarios that require Firefox. After googling about the issue for 5th time we found a solution which is extremely simple and works well for us. You just need to add
-Y when you are ssh-ing into your development box e.g.
ssh -Y devbox.
Solution is documented in a message on Apple discussion forum - https://discussions.apple.com/message/16025066#16025066. Although some people reported that they still have some issues we haven’t experienced any of them.