Repackaging Matlab with Composer

rtrouton
Release Candidate Programs Tester

After working on the problem a while, I've found a way to repackage Matlab 2011b with Composer for my worksite's needs. I've documented the process I'm using and posted it here:

http://derflounder.wordpress.com/2011/12/11/repackaging-matlab-2011b-with-composer/

26 REPLIES 26

jarednichols
Honored Contributor

Nice doc. This is pretty much the same process I use.

+1

ianmb
Contributor

Is this still relevant for 2016A?

rtrouton
Release Candidate Programs Tester

@ianmb, this process still works for Matlab 2016A.

jrippy
Contributor II

I know this is an older thread (began in 2011 and last response in 2016!) but I thought I'd throw my $0.02 in just in case anyone else came across it.

While I've no doubt this works, especially considering Rich Trouton came up with it, I use Matlab's silent install method.
Now, to get the right files, you need to download the ISOs, not the DMG files from MathWorks. The DMGs only contain the "InstallForMacOSX.app" installer which will not let you install silently.

The ISOs contain the install.sh script and the options file. Configure that for your license key, then dump the entire ISO contents plus the config file in a folder and have it copy down to /tmp (or some other directory) in Composer. Create a simple postinstall to run the installer with the options file and let it go.

AVmcclint
Honored Contributor

@jrippy How do I find the ISOs? All the links I can find point me to the dmg with the java-based installer that I can't get to work through our proxy.

jrippy
Contributor II

@AVmcclint I wasn't the one to actually download the ISOs so I may be off a bit, but go to that same download page where the DMGs are. Just under the DMG links I believe, there was a link that said "Other downloads" or "See More Downloads" or something like that. When my colleague, our license administrator, clicked that, he saw the ISO downloads.
I wish I had the screenshots for you. I will try to get with him and see if we can get screenshots of that area but it was on the page but just in a way that our eyes traveled right over the option the first 5 times we looked at it.

Hope that helps.

AVmcclint
Honored Contributor

I found out from our MATLAB "administrator" account holder that it is only available under the administrator account access. I was able to get it downloaded and installed and I was reminded of how their software is unlike anything else. UGH.

Duke78
New Contributor III

Thanks for the details. Does this still work for 2018? What would you change if you were going to push out MatLab to clients that you wanted pointed to a license server?

dsavageED
Contributor III

For a license server based version the process is near enough identical. To link Matlab to license server(s) it essentially has the file /Applications/Matlab/MATLAB_RXXXXa.app/licenses/network.lic which contains something like:

SERVER SERVER_DNS1 SERVER_ID SERVER_PORT 
USE_SERVER
SERVER SERVER_DNS2 SERVER_ID SERVER_PORT 
USE_SERVER

mark_mahabir
Valued Contributor

Is the SERVER_ID the same as the MAC of the license server?

jrippy
Contributor II

@mark.mahabir Yes, the SERVER_ID is the same as the MAC address of the license server.

jrippy
Contributor II

@brwnbn @mark.mahabir As @dsavageED mentioned, the file is just placed in that location.
For our installs though, using the silent install method, I set the licensePath variable in the installer_input.txt config file and point it to our license stub named "license.dat". I'm not sure if it came from MathWorks or created/exported by our license server administrator.
The license.dat file is copied to a temporary location during the package install and verified as available before the silent install script runs.
The installer then goes on to create that network.lic file during setup.
There is plenty of other configuration you can do with the installer_input.txt file as well.

My license.dat stub looks like this:

# BEGIN--------------BEGIN--------------BEGIN
# MathWorks license passcode file.
# LicenseNo: 999999   HostID: MAC999999999
#                     HostID: MAC99999999A
#                     HostID: MAC99999999B
#
# R2017a
#

SERVER SERVER1.domain.com MAC999999999 PORT# PRIMARY_IS_MASTER
SERVER SERVER2.domain.com MAC99999999A PORT#
SERVER SERVER3.domain.com MAC99999999B PORT#

USE_SERVER

andrewhillary
New Contributor

@jrippy Thank you for your leads in terms of dumping with the contents of iso to a tmp folder and packaging them there. Can I know what post-install that you use to trigger the installation. I used this command ./install -mode silent -agreeToLicense yes but I guess it does nothing.

Thanks

donjakubczak
New Contributor III

I did a similar capture like DerFlounder in the above link but slightly modified. Since dragging the MathLab app into composer doesn't quite work like normal apps. What I did was use the installer and selected the log in to matlab account to down load the rest of the components and grabbed the license.dat file from our lmtools/flexnet server. Once installed and launched to verify it was getting a license from the server, I created a new folder in Applications named MatLab. Placed the app in that. Took a snapshot. Moved the app back out of the new folder back into Applications. Then finalized the post install snapshot and cleared up the rest of the modified folder cruff captured and then just created the PKG.

Launches nicely when the PKG was deployed via JAMF.

Liam_Donnelly
New Contributor II
New Contributor II

You can use the silent installer for 2019 instead of re-packaging it. You just need to package up the installer app and the license.lic file and put in a hidden location. Then reference that location in your silent installer command.

sudo /path/to/InstallForMacOSX.app/Contents/MacOS/InstallForMacOSX install -mode silent -agreeToLicense yes -fileInstallationKey 123456 -licensePath /path/to/license.lic

ianmasterson
New Contributor II

Does anyone have a good repackaging method without a FIK?

I'm comfortable with downloading the installation files and I only have a licence.dat file (which essentially just points to our campus license server).

dlondon
Valued Contributor

I'm really struggling with this. Working on MATLAB2020b and just setting up as needed. Then, dragging the installed App from /Applications into the bottom left of Jamf Composer. Instead of the normal folder structure /Applications with the App MATLAB_R2020b, I see the contents of the App at the Root level i.e. no Applications folder and no MATLAB_R2020b.app inside it

b3dd7210e02c4d14be9ff52ebe2911d0

Any thoughts on this?

I'll give @Liam.Donnelly 's method above a try in the meantime.

dlondon
Valued Contributor

Well packaging the installer in /tmp was more successful than the installed App

However there seems to be something wrong with the postinstall command for the package. I tried it from the command line just to see what error I was getting:

sudo /private/tmp/InstallForMacOSX.app/Contents/MacOS/InstallForMacOSX install -mode silent agreeToLicense yes -fileInstallationKey MyFileInstallationKeyHere -licensePath /private/tmp/license.dat Password: BAD KEY VALUE, no '-' prefix: "install" find: installer_9039: No such file or directory find: installer_9039/archives: No such file or directory find: installer_9039/archives: No such file or directory

It doesn't look like that word install is correct. This is the only place I have found this form of the installation so far

Ammar
New Contributor II

@dlondon Did you get any further with this? I packaged the installer in /tmp but I am getting a different error below

/private/tmp/matlab2021/InstallForMacOSX.app/Contents/MacOS/InstallForMacOSX: line 312: exec: /private/tmp/matlab2021/bin/maci64/install_unix_legacy: cannot execute: No such file or directory

dlondon
Valued Contributor

Hi @Ammar - greetings to another Jamf Admin downunder :)

Yes I did get somewhere. Here's my notes:

This is the method used after trying a lot of other ways which all failed because the App was too big. This way downloads the files and uses an answer file (installer_input.txt) and a license file (license.dat)

1) get the download file from the Mathworks web site for the latest version

https://au.mathworks.com/ Sign in at the top right Download the Matlab Individual Installer for the latest version (2020b in this case)

2) you place the downloaded DMG in some folder such as ~/Downloads/mathworks

You open the DMG and run the executable You enter your info and then choose to download all the files and tell it the location is ~/Downloads/mathworks Many, many hours later you have the files.

3) Move the mathworks folder to /private/tmp

Place a copy of installer_input.txt in /private/tmp Place a copy of license.dat (or whatever you call it) in /private/tmp

4) Drag installer_input.txt into composer from /private/tmp and rename the project to something meaningful like the version of Matlab

With that project hilighted, drag license.dat from /private/tmp into ther right pane of composer to add it Then drag mathworks folder from /private/tmp into the right side tools Add a postinstall script into the project with this:

/private/tmp/mathworks/R2020b/install -inputFile /private/tmp/installer_input.txt

Create package Upload to Jamf Pro using Jamf Admin

My file installer_input.txt looks like this:

##################################################################
##
## Use this file to specify parameters required by the installer at runtime.
##
## Instructions for using this file.
##
## 1. Create a copy of this template file and fill in the required 
##    information.  
##
## 2. Uncomment only those lines that start with a single '#'
##    and set the desired values. All allowed values for the 
##    parameters are defined in the comments section for each 
##    parameter. 
##
## 3. Launch the installer from the command line, using the -inputFile option
##    to specify the name of your installer initialization file. 
##
##    (Windows) setup.exe -inputFile <file_name>
##    (Mac/Unix) install -inputFile <file_name>
##

destinationFolder=/Applications

fileInstallationKey=YourFileInstallationKeyHere

agreeToLicense=yes

outputFile=/tmp/mathworks_install.log

mode=silent

licensePath=/tmp/license.dat

#################################################################

And the license.dat file is just your normal license.dat file that points at your license server

The postinstall script for the package looks like this:

#!/bin/sh
## postinstall

pathToScript=$0
pathToPackage=$1
targetLocation=$2
targetVolume=$3


/private/tmp/mathworks/R2020b/install -inputFile /private/tmp/installer_input.txt

Ammar
New Contributor II

Hi Dlondon,

 

Greetings! Thank you very much for that detailed response you saved me a lot of hassle! Matlab has now worked. Much appreciated!

 

Cheers mate!

Hemanthkumar
New Contributor

Hi Dlondon,

Thanks you for the detailed explanation about packing, Matlab deployment is working as expected.

Regard's

Hemanth

tdenton
Contributor

@dlondon 

have followed the instructions you provided getting this error

 The install failed. The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. The package is attempting to install content to the system volume

dlondon
Valued Contributor

So what happens if you break it down and do it manually instead of packaging into a pkg file with a post install script?  That is, if you run this command:

sudo /private/tmp/mathworks/R2020b/install -inputFile /private/tmp/installer_input.txt 

 

tdenton
Contributor

@dlondon did use this method in the end works a treat.

 

Good Evening All.

Has anyone got a workflow there happy to share, to apply security updates to Matlab.

I appear to have some permission issues that I'm sorting out at the moment. It's preventing the updater run.

Be interested to hear your thoughts on this.

Thanks