MATLAB: Do I see a prompt to “accept incoming network connections” each time I launch MATLAB on a Mac

MATLAB

Why do I see a prompt to "accept incoming network connections" each time I open MATLAB?
Even after I choose "Allow", this message still appears every time I open up MATLAB. My firewall is enabled on my computer but I have an exception setup for "MATLAB".

Best Answer

Clicking "Allow" works with no harm but you may still see the prompt appear every time that MATLAB is launched. MathWorks is actively developing a fix for the issue which may be incorporated into a future release of MATLAB.
As a workaround you can launch MATLAB from the 'Terminal' by directly entering the location of the MATLAB executable or by using a shell script.
You will be prompted to accept the network connections the first time you launch MATLAB and all further launches through the 'Terminal' will not display the network message.
1. To launch MATLAB from the 'Terminal' by directly entering the location of the MATLAB executable:
1a. Launch 'Terminal' (This may be present in Applications > Utilities)
1b. Inside the 'Terminal' window type the location of the MATLAB executable. For example,
/Applications/MATLAB_R2019a.app/bin/matlab
2. To launch MATLAB from the 'Terminal' using a shell script:
2a. Create a shell script and save it on the Desktop or desired location for easy access:
a. Launch 'Terminal' (This should be present in Applications > Utilities)
b. Type 'cd <desired location>' inside the 'Terminal' window. For example: cd desktop to change the current directory.
c. Type 'vim <filename>' inside the 'Terminal' window to create a new file with the desired filename.
d. Press the letter 'i' on your keyboard to enter the INSERT mode.
e. Inside the file type the below commands:
#!/bin/sh
# location of the MATLAB executable script with respect to the current desired location. For example:
/Applications/MATLAB_R2019a.app/bin/matlab
f. Press the 'esc' key on the keyboard to exit the INSERT mode.
g. To save the file, type in a colon followed by wq. i.e :wq
2b. Make the shell script executable by typing the bellow command in the 'Terminal' window:
chmod u+x <filename>
You can now launch MATLAB by double clicking the file or typing the below commands inside the 'Terminal' window:
cd <file location>
sh <filename>
An alternate workaround is to disable the built-in firewall on MAC.
WARNING: Disable MAC's firewall ONLY if you are behind a trusted router with a firewall.
To do so go to System Preferences > Security and Privacy > Firewall and click "Turn Off Firewall".