Virtual Reality on macOS

Tom Goddard
November 15, 2018
updated January 4, 2019 and March 5, 2019 and July 15, 2019 and September 30, 2019 and October 15, 2019 and October 8, 2020

Here are details of using HTC Vive and Vive Pro virtual reality headsets with Mac laptop computers and an external GPU (eGPU) and also iMac computers with and without eGPU. I investigated this VR setup because many research labs at UC San Francisco use Mac laptops for visualizing molecular structures. The VR application I tested was ChimeraX.

Results

The HTC Vive headset worked on macOS 10.14 (Mojave) and gave smooth rendering similar to Windows 10 using a Radeon Vega 56 external GPU. Setting up the eGPU to run on Mac laptops older than 2017 where it is not officially supported by Apple poses problems. A specific beta version of SteamVR is needed called macos_default, and there were no special setup problems. The Vive Pro headset also works with eGPU and in addition works with an iMac with Radeon Pro 580 or 575 graphics and no eGPU.

The current SteamVR beta macos_default is version 1539100633, built Oct 9, 2018 at 08:57. This is a year old with no updates and no longer works with the Valve labeled basestation 2.0 (see Sept 30 comment below). It would not be surprising if Mac SteamVR breaks in the next 6 months due to a Steam update or macOS update. Since Valve is not maintaining SteamVR on macOS that will be the end of VR on Mac. Since 99% of VR use is on Windows, it is best to use Windows if possible.

October 8, 2020: Remarkably Vive Pro is working with macOS 11.0 Big Sur beta 9. Tested with a 2017 iMac (model 18,3) with Radeon Pro 580 graphics, headset connected directly with no eGPU. Tests were with ChimeraX VR using the same Oct 9, 2018 SteamVR macos_default version. Valve (developer of SteamVR) officially dropped support for macOS in April 2020, although in 2019 in a tech support email from Valve they said Mac SteamVR was an unsupported beta -- so it seems they never considered Mac supported.

October 15, 2019: Vive and Vive Pro headsets are both working with macOS 10.15 Catalina (official release). Tested with a 2017 iMac (model 18,3) with Radeon Pro 580 graphics, headset connected directly with no eGPU. Also working with the same iMac and an eGPU, Sonnet Breakaway Box 550 with Radeon Pro Vega 56 graphics. Initially I had trouble with the Vive Pro and no eGPU using a usbc to minidisplayport cable model cable creation CD0498 getting SteamVR error "Headset not connected properly (208)" but this was fixed using a different cable model cable matters 201076. Tests were with ChimeraX VR using the same Oct 9, 2018 SteamVR macos_default version.

September 30, 2019: There are now two versions of Vive basestation 2 and the more recent version does not work with macOS 10.14 (Mojave). I believe the more recent version came out around March 2019. The more recent version has Valve written on the back while the older version has SteamVR as shown in the picture (right). Both are basestation 2.0, model 1004. I obtained the new basestations under warranty replacement from HTC -- when I asked for the older basestation 2.0 style they said it is not made anymore. The original Vive basestation 1.0 models continue to work with Vive and Vive Pro on macOS.

July 15, 2019: Vive does not work directly connected to a 2017 iMac (model iMac18,3), macOS 10.14.5 (Mojave) with Radeon Pro 580 graphics although Vive Pro does work with direct connection. The Vive does work with this iMac using an eGPU (Sonnet Breakaway 550, with Radeon Vega 56). For the direct Vive connection I used a USBC to mini-display port cable (that works with Vive Pro). Starting SteamVR gives a headset not connnected error. The Vive headset has a red light on the side rather than the usual green light. The green light on the side of the headset does come on for about 1 second when unplugging and replugging the Vive link box but then turns red. I tried two different USBC to mini-display port cables. The Vive works with the eGPU using a mini-display port to full-size display port cable.

March 5, 2019: Vive Pro works with two 2017 iMacs (model iMac18,3), one with Radeon Pro 575 graphics and one with Radeon Pro 580 graphics without an eGPU. Proteins of 5000 atoms display with no flicker in ChimeraX. DICOM medical image series 512 by 512 by 280 grid points flickers with macOS 10.14.3 (Mojave) and Radeon Pro 580 if zoomed so the volumetric rendering takes more than 2/3 of the field of view, but is smooth at smaller sizes, apparently a graphics texture fill rate limitation. The 580 graphics has similar speed to an Nvidia GTX 1060 or AMD Radeon RX 480 which is the minimum recommended by HTC for Vive and Vive Pro headsets. Vive Pro link box connected to iMac with a USBC/Thunderbolt 3 to mini-displayport cable. An Apple USBC/Thunderbolt 3 to Thunderbolt 2 adapter does not work since mini-displayport required by the Vive Pro is not the same as Thunderbolt 2 although they have the same physical connector.

January 4, 2019: The Vive Pro now works with a 2017 iMac (model iMac18,3) using a Radeon Vega 56 eGPU. The SteamVR app no longer crashes as it did in previous tests, room-scale room setup works correctly, and tracking is smooth using ChimeraX using the SteamVR macos_default beta. The SteamVR display mirror option does not work, crashing the SteamVR compositor.

November 15, 2018: The Vive Pro headset also worked well with ChimeraX, but there are some difficulties: 1) The SteamVR status window that shows green icons for the headset, hand controllers, and base stations (app called vrmonitor) always crashes as soon as it starts. But VR works none-the-less since the SteamVR compositor starts and works. Room setup is usually done via a menu on the status window, but can be run from the command-line when using Vive Pro. Shutting down SteamVR involves tediously killing several processes (vrserver, vrcompositor, vrdashboard, ipcserver_vr) which is normally done by the broken status window. Apple announced Vive Pro support would be in macOS Mojave in June 2018 but has made no further announcements that this has been achieved as of November 2018. So it may take more time for the Vive Pro headset to work as well as the Vive headset.

Equipment: eGPU is black box at back to left of monitor. Vive (black) and Vive Pro (blue) headsets, and 2012 MacBook Pro laptop.

Tested equipment

External GPU

While Apple began selling an iMac Pro computer with a fast enough GPU (Radeon Vega 56 or 64) to run Vive VR headsets, this machine starts at $5000 in its base configuration and we don't have one. Our aim is to allow reseachers with MacBook Pro laptops to use VR and none of those models have fast enough GPUs, so we use an external GPU in an enclosure connected to the laptop by Thunderbolt. Apple announced official support for eGPU in macOS 10.13.4 (High Sierra) but only in new machines that have Thunderbolt 3.

Thunderbolt 3 MacBook Pro laptop (2016). I tested a MacBook Pro 13-inch from late 2016 that has four Thunderbolt 3 USB C ports. This worked without any difficulties using the USB C cable provided with the Sonnet eGPU enclosure to connect it to the laptop, and an external display connected to the eGPU. When running ChimeraX on the laptop screen it reported it was using the Intel graphics (ChimeraX command "graphics driver"), and when the ChimeraX window was dragged to the external display the program reported ChimeraX was using the AMD Radeon graphics. For large molecular systems a 8x speed-up in rendering was evident. It is impressive that macOS can switch the GPU without the application ChimeraX knowing about it. ChimeraX has no capability to rebuild the grahics scene if the OpenGL context is lost. The same eGPU connected to a Windows 10 laptop was not able to switch the graphics processor when the window was dragged between the laptop screen and external screen.

Thunderbolt 1 MacBook Pro (2012). Apple does not support eGPU use with older computers that lack Thunderbolt 3. But before macOS 10.13.4 (March 2018) eGPUs were unofficially working on Thunderbolt 1 and 2. With 10.13.4 Apple somehow disabled support for eGPUs. Resourceful eGPU fans at egpu.io restored the capability to use eGPUs with older machines, described here. The fix requires modifying Mac kernel extensions. One approach disables System Integrity Protection and modifies the modules (and makes backups). Instead I took the safer approach using a USB stick and EFI boot where no modifications are done to system files -- instead at computer startup the modified kernel modules are loaded from the USB drive. This has the drawback of requiring a special startup - holding the Option key while powering the computer and choosing EFI Boot from the USB stick. Modifying system files with a script called purge-wrangler seemed safe enough and avoids the special boot process, but macOS automated updates will overwrite the modifications so they may need to be reapplied after each Mac security update. I used the EFI Boot from USB stick version 1.0.4 created by Goalque. This required running an installer to make the EFI directory, which is a normal directory, not an ISO image, on a USB thumbdrive. The EFI directory was just 1.3 Mbytes. When booting with Option key held down you choose to boot from the USB, in the menu you choose "load on Mac" (other options let you load into Windows I guess for use with Boot Camp). The eGPU worked exactly as on the supported laptop except that the screen menu bar did not show an icon to eject the eGPU before unplugging it. Unplugging the eGPU thunderbolt cable raises an error dialog saying it was unsafely ejected and advising to use the missing menu bar icon. To connect the eGPU USB-C to Thunderbolt 1 I used an Apple Thunderbolt 3 (USB-C) to Thunderbolt 2 adapter combined with a 0.5 meter Thunderbolt 2 (same as 1) cable.

Performance. I chose an AMD graphics card because Apple does not support Nvidia graphics cards. Although AMD lags behind Nvidia in top-end performance, the AMD Radeon RX 56 is about equivalent to an Nvidia GTX 1070, a mid-range VR graphics option. It is reported that external GPUs can have reduced performance compared to having the same card inside a desktop PC because the bandwidth and latency over the Thunderbolt connection. I did not observe any performance problem. ChimeraX does not continuously stream large amounts of data to the graphics card -- most data is loaded onto the card when molecular data sets are opened or their display changed, so it is not likely to stress the eGPU bandwidth. The eGPU was always as quiet as the laptop and stays cool. The GPU utilization can be shown by pressing Option-4 in macOS Activity Monitor (found in Applications / Utilities). In the image at the right the GPU usage was about 50% for a 60,000 atom molecular structure (PDB 1aon) with triangles per atom boosted to 50 (ChimeraX command "graphics atomTriangles 50") for better appearance. The spike to 100% GPU was from using ambient occlusion lighting, casting shadows from 64 directions (command "light soft").

Laptop charging. With the Thunderbolt 3 laptop the eGPU charges the laptop when plugged in which is a nice convenience. The Thunderbolt 1 laptop is not charged by the eGPU.

SteamVR

I installed Steam on macOS 10.14 with no issues, logged into my Steam account and installed SteamVR with no trouble.

SteamVR version. The standard SteamVR version did not run on Mac and it was necessary to choose from the Betas by ctrl-click on SteamVR in the Steam window Library tab, choosing Properties, and then the Betas tab. I tried 4 different SteamVR versions with both Vive and Vive Pro headsets

Only the macos_default version worked reliably. Other versions failed to start, with a wide array of different error messages such as could not launch compositor, headset not found, headset not connected properly, "Hmm that shouldn't have happened (119)," and often just the SteamVR window and dock icon appearing for a split second then disappearing with no error reported. In some versions the compositor started but the rendered graphics was just an occassional flash right at your face depending on hand-controller positions.

Vive works. The macos_default version worked with the Vive headset and I was able to do Room-scale setup or Seated setup with no problems. This was with an HDMI cable connecting the Vive link box to the eGPU. I normally use a display port cable (the Vive link box has both HDMI and mini-DisplaPort connections) and display port did not work giving an error when starting SteamVR saying "Headset not connected properly".

Vive Pro problems.

January 4, 2019:
Vive Pro is working correctly with the macos_default SteamVR version on a 2017 iMac connected to the eGPU by USBC cable. The SteamVR app does not crash.

November 15, 2018:
With the Vive Pro using generation 1 or 2 base stations the macos_default SteamVR version worked best but has some problems. First the vrmonitor window that shows green icons for headset, hand-controllers and base stations, flashes for a split second at startup as does its dock icon then vanishes, apparently crashed. The vrcompositor does start as do the other normal SteamVR processes. The image at right from Activity monitor shows the normal SteamVR processes when using the Vive, and with Vive Pro all start except vrmonitor. Thinking the problem may be because the Vive Pro link box connects by display port, I tried a display port to HDMI adapter (the Vive Pro link box does not have an HDMI port) and connected by HDMI cable to the eGPU but SteamVR failed to start with "Headset not connected properly". Only the display port cable worked.

Room setup with Vive Pro.

January 4, 2019:
Room-scale room setup is working correctly with the macos_default SteamVR beta version on a 2017 iMac and eGPU. I did not try seated setup.

November 15, 2018:
Room setup is done from the vrmonitor window (a pull-down menu). To work around it crashing on startup I ran room setup from a Terminal using:

    cd ~/Library/Application\ Support/Steam/steamapps/common/SteamVR/SteamVR.app/Contents/MacOS/tools/steamvr_room_setup/osx
    open -a steamvr_room_setup.app
  

Shutting down SteamVR with no vrmonitor is a pain. I use activity monitor and double click on vrdashboard and select Quit, then Force Quit, then do the same for vrserver, and ipcserver_vr.

SteamVR Mirror Window (January 4, 2019) Enabling the SteamVR display mirror option from the SteamVR menu causes the SteamVR compositor to crash and VR no longer works. This is on a 2017 iMac with eGPU. The mirror window flashes briefly on the screen before the crash. After this restarting SteamVR fails because the compositor crashes. This is because SteamVR remembers that you enabled the mirror window and now will try to show it every time it starts. To fix this edit the SteamVR configuration file

    ~/Library/Application Support/Steam/config/steamvr.vrsettings
  

changing the "showMirrorView": true line to "showMirrorView": false

Ways to launch SteamVR. Simply starting ChimeraX, moving its window to the external display so that it uses the eGPU, and using ChimeraX command "vr on", automatically starts SteamVR without starting Steam or SteamVR ahead of time. I also sometimes started Steam, and from the Steam library tab chose SteamVR and pressed the Play button, then started ChimeraX. Both ways worked.

External display.

January 4, 2019:
I found that the VR headset can use the eGPU without an external display connected to the eGPU. To make ChimeraX use the eGPU control-click on its icon, select Get Info, and enable the "Prefer external GPU" setting. I believe this setting is only available on macOS Mojave (10.14). With this setting ChimeraX started on the iMac display but ChimeraX command graphics driver reported it was using the eGPU to render. The Vive Pro VR headset connected to the eGPU with no external display and worked. The VR view flickered and was not usable if ChimeraX mirrored the headset view to its desktop window, probably because that required the rendered image to be sent to the iMac GPU for rendering on the iMac screen which was too slow. ChimeraX can disable mirror rendering by starting vr with command "vr on display blank", and then headset rendering was smooth.

November 15, 2018:
I did not attempt to use SteamVR and ChimeraX without an external display, with only the VR headset connected to the eGPU. It would be a slightly simpler setup if that worked but seems unlikely to work.

Vive Tracking Problem

I did some of the testing in a small 2 meter by 1.5 meter cubicle and tracking of the hand controllers and headset were very poor with hand controllers jumping around and flying off into the distance. Tracking was poor with both Vive generation 1 base stations and Vive Pro generation 2 base stations. The setup is shown in the image. It turned out that the problem was reflections of the base station IR lasers off of the (unused) iMac monitor positioned high in the corner. Covering that display with a T-shirt made tracking perfectly stable.

ChimeraX Fixes for Mac VR

My initial attempts to use ChimeraX VR on macOS gave slow flickering rendering at about 5 frames per second. If I mirrored the VR headset to the desktop display it rendered smoothly in the left eye but dropped half the frames in the right eye. To avoid the mirroring to a 60 frame/sec flat panel display slowing the VR graphics the ChimeraX application disables waiting for vsync when rendering with OpenGL. The flickering in the right eye was resolved by adding glFlush() calls after submitting each eye image in ChimeraX. On Windows and Linux this was not needed but it seems the SteamVR compositor does not flush the rendering buffers on macOS.

Other VR headsets: Oculus Rift, Windows Mixed Reality

I believe the Oculus runtime or the Windows Mixed Reality runtime are not available on macOS. Those only support Windows (including possibly Windows emulation on a Mac such as Boot Camp).

Microsoft Windows

The same eGPU tested here worked fine with a Windows 10 laptop (MSI GS65 Stealth THIN-068 with GTX 1070 MaxQ GPU). The laptop had GTX 1070 graphics capable of running VR without an eGPU and also Intel graphics. One difficulty was figuring out how to specify which of the 3 GPUs to use. Ctrl-click on the ChimeraX icon the Open with graphics menu only listed the Intel and Nvidia GPUs, not the AMD eGPU. The only solution I found was to make the eGPU external display the primary display. Then ChimeraX launched on that display and used the eGPU. If the ChimeraX window was dragged to the laptop display it continued using the GPU it started on.