Files
magic/INSTALL_MacOS.md
T
Darryl L. Miles 46eb71491c GHA: MacOS maintenance update
GHA obsoleted macos-12 so we move to macos-13 for Intel.  Building with oldest
Intel image to provide feedback of continued expected support on that platform,
while ARM64 builds with latest to check the other end of their SDKs.

Lock the TCL version via brew to 8.6+ (currently the project is not expected to
build on TCL9 until other work is completed) so this is causing build failure.

Added additional diagnostics to show the location of executables/DSOs if they
got built from the tree.

Introduced GHA timeout clamping (MacOS default shell seems not to behave under
CI as well as Linux does, re signal/pipe handling)

'brew install tcl-tk@8' appears to append the @8 to the installed path such as
/usr/local/opt/tcl-tk@8 which configure needs to know.  configure_mac updated
to detect this now TCL9 is the default version that maybe installed at the old
location.  Then there is the issue of both TCL versions being installed
side-by-side on the same system causing more issues over selection.
2025-01-04 11:23:39 -05:00

2.2 KiB

Installing Magic on macOS (Tested on Big Sur)

With Brew

Get Homebrew.

# TCL9 should be supported soon (Q2 2025)
brew install cairo tcl-tk@8 python3
brew install --cask xquartz
./scripts/configure_mac
# If you have both TCL8 and TCL9 installed you may need to verify TCL8 was selected.
make database/database.h
make -j$(sysctl -n hw.ncpu)
make install # may need sudo depending on your setup

Without Brew

Get XQuartz

Build Tcl for X11

We are following the instructions from xschem (https://github.com/StefanSchippers/xschem/blob/master/README_MacOS.md).

We are using not opt but opt2 so that this Tcl does not interfere with tcl-tk from HomeBrew.

Extract the Tcl sources and then go to the unix folder and execute the following commands::

./configure --prefix=/usr/local/opt2/tcl-tk  
make
make install

Build Tk for X11

Extract Tk source and then go to the unix folder:

NOTE: before running 'make' inspect the Makefile and ensure the LIB_RUNTIME_DIR is set as follows. Make the correction if not:

LIB_RUNTIME_DIR         = $(libdir)
./configure --prefix=/usr/local/opt2/tcl-tk \
--with-tcl=/usr/local/opt2/tcl-tk/lib --with-x \
--x-includes=/opt/X11/include --x-libraries=/opt/X11/lib  
make
make install

Build magic

We need to provide this tcl-tk and suppress compilation errors.

./configure --with-tcl=/usr/local/opt2/tcl-tk/lib \
--with-tk=/usr/local/opt2/tcl-tk/lib \
--x-includes=/opt/X11/include \
--x-libraries=/opt/X11/lib \
CFLAGS=-Wno-error=implicit-function-declaration
make
make install

If facing issue with layout window not opening / XQuartz:

Make sure that the output of the following command is :0.

echo $DISPLAY

if the above command doesn't display :0 then add the following line in .zshrc.

export PATH="/opt/X11/bin:$PATH"

Close & reopen terminal to load the path. Then set display manually to 0 by using the following command.

export DISPLAY=:0

Now echo DISPLAY should give :0 as output.