Tuesday, June 16, 2020

AutoDesk 2021 Silent Install

Installing AutoDesk Suite

Despite COVID, Fall classes are quickly approaching and that means it's time to deploy new software! Up next, AutoDesk AutoDesk 2021, Maya 2020, and Mudbox 2020. 

AutoCAD 2021

After attempting to install using their --silent flag and it failing due to no user being logged in, I decided to rip apart the DMG and see what it does...
"Silent" Install flag:
"Silent" install for the whole suite: 

After I was able to get the install done, I then had to figure out how to register it so it doesn't prompt the user. In the past, network Registration was done with a license file, but I'm not sure this is needed any longer: 

The license file didn't really work as I expected, it always prompted the user for the LM server. Eventually I found the following document on pointing to a license manager:


This tool helps us point our software to the license manager and prevent the software from prompting the user. We use this for all of the AutoDesk software.

#Set Locale
wait defaults write .GlobalPreferences AppleLocale -string "en-US"
# Clean Out OLD/Failed Installs
wait rm -R "/Applications/Autodesk/AutoCAD*"
/usr/bin/hdiutil attach -quiet -nobrowse -mountpoint "/tmp/AutoCAD" "PATH_TO/Autodesk_AutoCAD.dmg"
installer -pkg "/tmp/AutoCAD/Install Autodesk AutoCAD 2021 for Mac.app/Contents/Helper/ObjToInstall/autocad2021.pkg" -tgt /
installer -pkg "/tmp/AutoCAD/Install Autodesk AutoCAD 2021 for Mac.app/Contents/Helper/Packages/Licensing/AdskLicensing-" -tgt /
installer -pkg "/tmp/AutoCAD/Install Autodesk AutoCAD 2021 for Mac.app/Contents/Helper/Packages/AdSSO/AdSSO-v2.pkg" -tgt /
installer -pkg "/tmp/AutoCAD/Install Autodesk AutoCAD 2021 for Mac.app/Contents/Helper/ObjToInstall/lib.pkg" -tgt /
#Create a License Server File with the contents:
#SERVER {parameter "LICENSE_SERVER21"} 000000000000
#Place the file in "/Library/Application Support/Autodesk/AdskLicensingService/777M1_2021.0.0.F/licpath.lic"
# Reload the Licensing Service
launchctl unload "/Library/LaunchDaemons/com.autodesk.AdskLicensingService.plist"
launchctl load "/Library/LaunchDaemons/com.autodesk.AdskLicensingService.plist"
installer -pkg "/tmp/AutoCAD/Install Autodesk AutoCAD 2021 for Mac.app/Contents/Helper/ObjToInstall/licreg.pkg" -tgt /

/usr/bin/hdiutil detach -force "/tmp/AutoCAD"
"/Library/Application Support/Autodesk/AdskLicensing/Current/helper/AdskLicensingInstHelper" change -pk $AUTOCAD21_pk -pv $AUTOCAD21_pv -ls "@${AUTOCAD21_LICENSE_SERVER}" -lm NETWORK

Maya 2020

Following AutoCad, I ripped apart Maya and found the following packages that needed installed:

/usr/bin/hdiutil attach -quiet -nobrowse -mountpoint "/tmp/Autodesk_Maya" "PATH_TO/Autodesk_Maya.dmg"
installer -pkg "/tmp/Autodesk_Maya/Install Maya 2020.app/Contents/Helper/Packages/Maya/Maya_core2020.pkg" -tgt / installer -pkg "/tmp/Autodesk_Maya/Install Maya 2020.app/Contents/Helper/Packages/Licensing/AdskLicensing-" -tgt / installer -pkg "/tmp/Autodesk_Maya/Install Maya 2020.app/Contents/Helper/Packages/Licensing/adlmframework18.pkg" -tgt / installer -pkg "/tmp/Autodesk_Maya/Install Maya 2020.app/Contents/Helper/Packages/Licensing/adlmapps18.pkg" -tgt / installer -pkg "/tmp/Autodesk_Maya/Install Maya 2020.app/Contents/Helper/Packages/AdSSO/AdSSO-v2.pkg" -tgt / installer -pkg "/tmp/Autodesk_Maya/Install Maya 2020.app/Contents/Helper/Packages/Licensing/adlmflexnetclient.pkg" -tgt / installer -pkg "/tmp/Autodesk_Maya/Install Maya 2020.app/Contents/Helper/Packages/Maya/Maya_AdLMconf2020.pkg" -tgt / installer -pkg "/tmp/Autodesk_Maya/Install Maya 2020.app/Contents/Helper/Packages/Maya/MtoA.pkg" -tgt / installer -pkg "/tmp/Autodesk_Maya/Install Maya 2020.app/Contents/Helper/Packages/Maya/bifrost.pkg" -tgt / installer -pkg "/tmp/Autodesk_Maya/Install Maya 2020.app/Contents/Helper/Packages/Maya/SubstanceInMaya-2.1.2-2020-Darwin.pkg" -tgt / installer -pkg "/tmp/Autodesk_Maya/Install Maya 2020.app/Contents/Helper/Packages/Maya/motion-library.maya-1.1.0.pkg" -tgt /
mkdir -p "/Library/Application Support/Autodesk/AdskLicensingService/657L1_2020.0.0.F"
#Create a License Server File with the contents: # #SERVER "${MAYA20_LICENSE_SERVER"} 000000000000 #USE_SERVER # #Place the file in "/Library/Application Support/Autodesk/AdskLicensingService/657L1_2020.0.0.F/licpath.lic"
/usr/bin/hdiutil detach -force "/tmp/Autodesk_Maya"
"/Library/Application Support/Autodesk/AdskLicensing/Current/helper/AdskLicensingInstHelper" change -pk "$MAYA20_pk" -pv "$MAYA20_pv" -lm NETWORK -ls "@${MAYA20_LICENSE_SERVER"}"

Mudbox 2020

With Mudbox, I reduced to just the packages and the AdskLicensingInstHelper, which seemed to do all the things needed to point to the server and retrieve a license.

rm -Rf "/Applications/Autodesk/Mudbox*"
/usr/bin/hdiutil attach -quiet -nobrowse -mountpoint "/tmp/Autodesk_Mudbox" "PATH_TO/Autodesk_Mudbox.dmg"
installer -pkg "/tmp/Autodesk_Mudbox/Install Mudbox 2020.app/Contents/Packages/ADLM/AdskLicensing-" -tgt / installer -pkg "/tmp/Autodesk_Mudbox/Install Mudbox 2020.app/Contents/Packages/ADLM/AdSSO-v2.pkg" -tgt / installer -pkg "/tmp/Autodesk_Mudbox/Install Mudbox 2020.app/Contents/Packages/ADLM/adlmapps18.pkg" -tgt / installer -pkg "/tmp/Autodesk_Mudbox/Install Mudbox 2020.app/Contents/Packages/ADLM/adlmflexnetclient.pkg" -tgt / installer -pkg "/tmp/Autodesk_Mudbox/Install Mudbox 2020.app/Contents/Packages/ADLM/adlmframework18.pkg" -tgt / installer -pkg "/tmp/Autodesk_Mudbox/Install Mudbox 2020.app/Contents/Packages/Mudbox/Mudbox_AdLMconf2020.pkg" -tgt / wait installer -pkg "/tmp/Autodesk_Mudbox/Install Mudbox 2020.app/Contents/Packages/Mudbox/Mudbox_core2020.pkg" -tgt /
wait /usr/bin/hdiutil detach -force "/tmp/Autodesk_Mudbox"
"/Library/Application Support/Autodesk/AdskLicensing/Current/helper/AdskLicensingInstHelper" change -pk "$MUDBOX20_pk" -pv "$MUDBOX20_pv" -lm NETWORK -ls "@${MUDBOX20_LICENSE_SERVER}"

Anyway, that's been my last four weeks! I hope this helps someone else, possibly even future me?! 

Wednesday, December 4, 2019

The end of 2019!

Wow, I felt like this year went bye so quickly. Life has a way of throwing everything at you that can't be compared to anything else I know. Still, I'm excited to see what 2020 has in store for us all!

With that, I wanted to share one trick I came up with real quick for the Terminal.app. I'm often navigating my files through the Terminal.app and need a quick way to open up larger files to edit. My choice of plain text editor is TextMate.app and my typical workflow was to "open ." to have the finder show the current folder and then drag the file to TextMate or double click it. Sometimes, depending on the file type association, I could type "open filename" and it would get me to TextMate.app, sometimes not. I started using "open -a TextMate.app filename", but it was repetitive. I could make an alias for "open -a TextMate.app" that would save me some time, but what if I wanted to make a new file and edit it?

The simple function below allows me to type "e filename" and open either a new or existing file. I've added this to my ~/.zprofile so it loads every time I open a shell window:
function e() { # edit existing or new document in textmate
if [[ ! -e "$filename" ]]; then
	touch "$filename"
open -a TextMate.app "$filename"

Hope it helps inspire or at least open documents quicker! If you have another app you prefer to use for text editing, you can change the "TextMate.app" to your preferred editor! Happy 2019 everyone, see you next year! 

Monday, August 6, 2018

Icon, therefore I am.

    We recently discovered that the common method for setting file icons using sips, DeRez, Rez, and SetFile has stopped working on High Sierra. Sips seems to have removed the function needed, instead printing "addIcon is no longer supported". After a bit of digging and combining existing code, I found that getting and setting a file/folder icon is pretty easy.

This script allows you to either 1) export an icon from a file path or 2) set a file icon from an image. Usage is:

Export Icon:
./fileIcon.py /path/to/file.ext
Set Icon:
./fileIcon.py /path/to/icon.img /path/to/set/file.ext
 Code (also on GitHub)
#!/usr/bin/python# python script that extract an icon from an OSX file and save it at jpeg# https://superuser.com/questions/133784/manipulate-mac-os-x-file-icons-from-automator-or-command-line
# https://apple.stackexchange.com/questions/6901/how-can-i-change-a-file-or-folder-icon-using-the-terminal/198714
from AppKit import *
import sys, Cocoa
if len(sys.argv) == 2:
    print "One argument"
    for path in sys.argv[1:]:
        print path
        NSBitmapImageRep.imageRepWithData_(NSWorkspace.sharedWorkspace().iconForFile_(path).TIFFRepresentation()).representationUsingType_properties_(NSJPEGFileType, None).writeToFile_atomically_(path+".jpg", None)
elif len(sys.argv) == 3:
    print "Two argument"
    NSWorkspace.sharedWorkspace().setIcon_forFile_options_(Cocoa.NSImage.alloc().initWithContentsOfFile_(sys.argv[1].decode('utf-8')), sys.argv[2].decode('utf-8'), 0) or sys.exit("Unable to set file icon")
    print "Get Icon with path to file"
    print "Set Icon with path to icon, path to file"

Friday, May 18, 2018

Where are my 32bit apps?

     Recent versions of macOS High Sierra are warning users that their applications are "not optimized" for their Mac. This message is caused when 32bit applications are built and there are tons of articles explaining this. For more information, you can search for them.

    Above is an example of the warning for the app "DjView", which is compiled as 32bit and opened on High Sierra 10.13.4. This message is simple to dismiss, but annoying for users in lab environments where their "acceptance" of the less-than-optimized versions are not stored from session to session. Apple has provided the ability to prevent this message by using the following command within the recovery environment (MacObserver Post):
sudo nvram boot-args="-no32exec"
    This preference is helpful, but less so as it's restricted to an environment that requires some admin interaction with the actual hardware. I've also seen suggestions that the following defaults command can be run as root to disable the warnings:
sudo defaults write -g CSUIDisable32BitWarning -boolean true
    I've not had the same luck with the defaults command that others have so your mileage may vary. The best resolution to this message is likely going to be replacing the 32bit apps with 64bit versions. This is harder than it sounds, as some applications used in our lab environments have not been updated in a few years or more. Developers are likely not going to be able to quickly "patch" these apps with a new 64bit build, so finding replacements or ignoring the message may be the most common resolution.

    So, where are all your 32bit apps? Well, most of the articles I've found direct you to look at the System Information.app, which has a nice list of Applications and a Yes/No column for 64-Bit (9TO5Mac Source). I prefer a less GUI method and have found two additional methods for locating apps.

    The first method uses mdfind and the Spotlight database to locate files that have the 'i386' architecture and excludes anything that is already 64 bit. Excluding 64-bit apps explicitly is important because some binaries are built with both 32 and 64 bit. Update: Testing an app that's universal seems to still prompt, for example SoundHack.app displayed the warning. These "universal binaries" shouldn't interfere with the transition to 64-bit only (E.G /usr/bin/chsh). Using the following command in the Terminal.app should return all of the files that are 32 bit that spotlight knows about:
mdfind "(kMDItemExecutableArchitectures == 'i386') && (kMDItemExecutableArchitectures != 'x86_64')"

    The second method uses the find command to locate any file that reports itself as an 'i386' executable. Using find is helpful for locating binaries that might not be in the spotlight database. It also works on systems where the spotlight database was disabled for some reason. Running the following command in the Terminal.app is likely to return more than you want to see, but I prefer to trim out things I don't care about rather than miss them completely:
find / -type f -perm +111 -exec file -p {} \; -exec head -c 1 /dev/zero \; | xargs -0 -n 1 sh -c 'echo "$@" | head -n 1' -- | grep -v x86_64 | grep -E Mach-O.+i386
     Both commands can be found on this StackExchange post: 

     Many thanks to the others who have helped explain and locate 32-bit apps. Hopefully, this information can be as helpful to others as it was for me! If anyone has a method for disabling this prompt on High Sierra that doesn't require the recovery partition, please let me know! Bonus points for a configuration profile!