Just for completeness, do the following in Terminal.app:
export BREWDIR=/usr/local # if you are on a Intel machine
export BREWDIR=/opt/homebrew # if you are on a Apple Silicon machine
mkdir $HOME/x13as
cd $HOME/x13as
curl -O https://www2.census.gov/software/x-13arima-seats/x13as/unix-linux/program-archives/x13as_asciisrc-v1-1-b61.tar.gz
tar xf x13as_asciisrc-v1-1-b61.tar.gz
sed -i '' 's/-static//g' makefile.gf
make -j$(sysctl -n hw.ncpu) -f makefile.gf FC=$BREWDIR/bin/gfortran LINKER=$BREWDIR/bin/gcc-14 FFLAGS="-O2 -std=legacy" LDFLAGS=-static-libgcc LIBS="$BREWDIR/lib/gcc/current/libgfortran.a /$BREWDIR/lib/gcc/current/libquadmath.a" PROGRAM=x13as
mkdir -p $HOME/.local/bin
cp x13as $HOME/.local/bin/x13as
Then run the following command in Octave or MATLAB:
system('which x13as')
% /Users/wmutschl/.local/bin/x13as
system('x13as')
% X-13ARIMA-SEATS Seasonal Adjustment Program
% Version Number 1.1 Build 61
% Execution began Mar 28, 2025 08.59.12
%
% ERROR: Must specify either an input specification file name
% (-i infile or infile) or an input metafile name (-m metafile).
%
% See Section 2 of the X-13ARIMA-SEATS Reference Manual for more
% information on how to run X-13ARIMA-SEATS.
This means that Octave or MATLAB can find x13as.