The OpenConnect-GUI client provides a graphical interface to the OpenConnect VPN client for both macOS and Windows.
Currently, a package for the latest release of macOS is not provided. Since I wanted to use the same package on both macOS and Windows and have the latest release I decided to build the macOS package myself. Unfortunately there aren't any instructions provided and searching the web did not surface instructions by others attempting build the macOS package from source so I had to come up with something that worked for me by reading what I could find and a lot of trail and error.
The following instructions are my solution for building a universal package for OpenConnect-GUI that runs on macOS 12 and newer. Some of the complexity in getting everything to build properly was due to my desire to have the package work on macOS 12. Yes, it is EOL now but just recently so and it indicates that it supports macOS 12 so it seemed like it would be good come up with a complmentary solution. I believe if instead the package was only built to support macOS 13 and newer that a standard brew install of qt6 would suffice instead of building it from source to have a target of macOS 12.
The build process can be done on any current macOS but I didn't want to polute my machines working environment with unnecessary complexity so I elected to use a virtual machine for my environment running using UTM.
Navigate to https://mac.getutm.app to download UTM and install.
Navigate to https://ipsw.me and download the latest ipsw file for macOS.
Create a new VM using the ipsw file that you downloaded. Use a 100 GB size for the disk and 2 CPU cores.
Once the installation of the VM is complete you will want to perform a few additional configuration steps to prepare for the build process.
In order to reduce things that might slow down the VM it is helpful to disable screensavers, screen locking and power saving features.
Open Settings and do the following:
- Click Energy on the sidebar.
- Turn On "Prevent automatic sleeping when the display is off".
- Click Done.
- Click Screen Saver on the sidebar.
- Click Lock Screen Settings....
- Set "Start Screen Saver when inactive" to Never.
- Set "Turn display off when inactive" to Never.
- Set "Require password after screen saver begins or display is turned off" to Never.
- Enter password when prompted and click Modify Settings.
- Click Turn Off Screen Lock.
Open Settings and do the following:
- Click on Privacy & Security on the sidebar.
- Click on App Management.
- Click +.
- Enter password when prompted and click Modify Settings.
- Navigate to Applications then Utilities and select Terminal.
- Click Open.
Note: There is a known issue that has existed for the past few years that prevents signing into the App Store from a macOS VM. Therefore, it is necessary to download Xcode directly. See:
- https://forums.developer.apple.com/forums/thread/707682
- https://forum.parallels.com/threads/cant-sign-in-to-app-store-in-macos-guest.365180
- utmapp/UTM#3617
- Navigate to https://xcodereleases.com.
- Click the Releases radio button.
- Click the Download link for the latest release. If prompted, log in using your Apple ID.
- Extract downloaded .xip file by double-clicking it in Finder.
- Move the extracted Xcode package to the Applications folder.
- Run Xcode and proceed through default setup process. (Note: There is no need to install the “Predictive Code Completion Model” if the option is checked so you can uncheck it.)
- Download Xcode 14.2 (https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_14.2/Xcode_14.2.xip)
- Extract it by double-clicking Xcode_14.2.xip in the Downloads folder.
- Copy SDK 13.1 SDK to Xcode SDKs directory by copying and pasting the following command into Terminal:
sudo cp -RP ~/Downloads/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk
Note: If you are presented with the following:
"Terminal" would like to access files in your Downloads folder.
Click Allow.
Copy and paste the following command into Termina:
rm -rf ~/Downloads/Xcode.app
Copy and paste the following command into Terminal:
softwareupdate --install-rosetta
Keep in mind the whole process will likely take more than a day because of the amount of time it takes to build qt6 from source and the fact it needs to be done twice.
Download and run the following scripts in Terminal:
./build-x86_64.sh
./build-aarch64.sh
./build-universal.sh