FreeBSD 14.0 install Mathematica 13.2

1. Enable Linux binary compatibility on FreeBSD

Run these commands with root:

# enable the Linux ABI at boot time
sysrc linux_enable="YES"

# start linux without rebooting
service linux start

# install CentOS Base System from FreeBSD Packages
pkg install linux_base-c7

2. Run the Mathematica Installer

  1. Run the command with root:
# set the default ELF brand to Linux for all unbranded binaries
sysctl kern.fallback_elf_brand=3
  1. Open the Linux installer with root:
vim Mathematica_13.2.1_LINUX_CN.sh

Replace the first line /bin/sh by /compat/linux/bin/sh.

  1. Set Mathematica_13.2.1_LINUX_CN.sh executable and install with root:
chmod a+x Mathematica_13.2.1_LINUX_CN.sh
./Mathematica_13.2.1_LINUX_CN.sh

Note that the default paths are set as:

  • /usr/local/Wolfram/Mathematica/13.2
  • /usr/local/bin

3. Modifying the Mathematica Executables

Replace /bin/sh by /compat/linux/bin/sh inside the files math, mathematica, Mathematica, MathKernel, WolframKernel, wolfram at the path /compat/linux/usr/local/Wolfram/Mathematica/13.2/Executables/, then make these files executable using the command chmod a+x with root:

#!/bin/sh
cd /compat/linux/usr/local/Wolfram/Mathematica/13.2/Executables/
for i in math mathematica Mathematica MathKernel WolframKernel wolfram
  do sed 's/\/bin\/sh/\/compat\/linux\/bin\/sh/g' $i > $i
  chmod a+x $i
done

Note that it doesn’t need to replace Linux with FreeBSD, otherwise it will show Cannot determine operating system..

4. Add the path of Mathematica Executables to ~/.zshrc

Open ~/.zshrc (vim ~/.zshrc) and add this command with common user:

export PATH=$PATH:/compat/linux/usr/local/Wolfram/Mathematica/13.2/Executables/

5. Run Mathematica Executables and input the Activation Key, Password

  1. Run the following Mathematica Executables with common user:
math
MathKernel
WolframKernel
wolfram
  1. According to the MathID, input the Activation Key and Password.

  2. Everything goes well as follows:

Mathematica 13.2.1 Kernel for Linux x86 (64-bit)
Copyright 1988-2023 Wolfram Research, Inc.

In[1]:= 

6. Reference