How to Install Unity and Visual Studio on Mac without Admin Rights

How to Install Unity and Visual Studio on Mac without Admin Rights

·

2 min read

I came across a situation where I was stuck with a work laptop that didn't allow me to install apps with system privileges... So I went with a workaround.

This assumes you still have sudo access needed to grant a Unity license and additional Visual Studio packages.

Installing Unity

Start with downloading Unity Hub for Mac. After opening the .dmg file, copy the "Unity Hub" App and paste it to ~/Applications (Use ⌘⇧G to access this folder). Don't drag it directly to Applications as it will ask you for a system password.

Continue following the installation as usual, but skip the granting license part.

When installing Unity, change the installation target directory to ~/Applications/Unity (create the Unity folder in ~/Applications first)

Now, we'll try to activate the Unity license. Use manual activation by using the "Activate with license request" as we can't use the "automatic" way without asking for a system password.

It will generate a .alf file, upload it to the unity site, download the .ulf, or licensed file. Then we activate it using Terminal.

# replace "2021.3.19f1" with your Unity version
~/Applications/2021.3.19f1/Unity.app/Contents/MacOS/Unity -batchmode -manualLicenseFile ~/Downloads/Unity_v2017.x.ulf -logfile

It should be activated and you can open Unity from now.

Installing Visual Studio

Download Visual Studio for Mac. Follow the usual installation steps.

Without the knowledge of the system password, we'll be stuck on this installation progress, and had to cancel:

Fornatunely, the download has just been cached. Open this folder in Finder using ⌘⇧G:

~/Library/Caches/VisualStudioInstaller/downloads/

Find the .dmg file contains Visual Studio, copy the "Visual Studio" app to ~/Applications.

Next, open a project with Unity. We will integrate Unity with Visual Studio.

Additional Setup for Unity + Visual Studio

Configure your Unity to Open External Script Editor with Visual Studio for Mac: (browse and locate the editor in ~/Applications/Visual Studio.app)

Next, open the C# Project. It should be opened with Visual Studio.

At first open, you will be asked to Install Mono, which is required so your project compiles:

Clicking Restart will not work as it will ask system password. We'll use Terminal to install it.

# go to temporary downloads. Change "17.0" with your version
cd ~/Library/Caches/VisualStudio/17.0/TempDownload/ 
# install all .pkgs there
sudo installer -pkg monoframework-mdk-6.12.0.188.macos10.xamarin.universal.pkg -target /
sudo installer -pkg microsoft-jdk-11.0.16.1-macos-aarch64.pkg -target /
sudo installer -pkg OpenJDK8U-jdk_x64_mac_hotspot_8u302b08.pkg  -target /

Things should works now. Enjoy!

References: