Skip to content

Instantly share code, notes, and snippets.

@itsbradwhite
Created May 22, 2023 22:48
Show Gist options
  • Save itsbradwhite/0875cfe4b121139d025cb9d26a54f201 to your computer and use it in GitHub Desktop.
Save itsbradwhite/0875cfe4b121139d025cb9d26a54f201 to your computer and use it in GitHub Desktop.
Unity macOS - Standard User Permissions Fix
#!/bin/sh
currentUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ { print $3 }' )
unityFolderPath="/Users/$currentUser/Library/Unity"
# Check if Unity folder exists, create it if it doesn't
if [ ! -d "$unityFolderPath" ]; then
echo "Unity folder does not exist. Creating it..."
mkdir -p "$unityFolderPath"
if [ $? -eq 0 ]; then
echo "Successfully created Unity folder."
else
echo "Failed to create Unity folder. Exiting."
exit 1
fi
else
echo "Unity folder already exists."
fi
# Change the ownership of the Unity folder to the current user
echo "Changing ownership of Unity folder to $currentUser..."
sudo chown -R $currentUser "$unityFolderPath"
if [ $? -eq 0 ]; then
echo "Successfully changed ownership of Unity folder."
else
echo "Failed to change ownership of Unity folder."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment