Mac OS: installing ngspice, magic, netgen, xschemInstall Homebrew/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" To check the version of Homebrew installed use the command: brew --version After installation, to keep your Homebrew system always current is recommended that you run on a regular basis brew update brew upgrade To install/uninstall a package use: brew install <package> brew uninstall <package> To check if a brew is installed use: brew list | grep <package> To check the location where a brew is installed use: brew list <package> To search for available packages with name containing TEXT use: brew search TEXT | /TEXT/ If TEXT is flanked by slashes, it is interpreted as a regular expression Example:
brew search /^tcl/ To learn more about brew use: man brew or take a look at this user guide or the official documentation Apple Silicon Mac vs. Intel Mac
eval "$(/opt/homebrew/bin/brew shellenv)" The brew shellenv command sets the following environment variables: export HOMEBREW_PREFIX="/opt/homebrew"; export HOMEBREW_CELLAR="/opt/homebrew/Cellar"; export HOMEBREW_REPOSITORY="/opt/homebrew"; export PATH="/opt/homebrew/bin:/opt/homebrew/sbin${PATH+:$PATH}"; export MANPATH="/opt/homebrew/share/man${MANPATH+:$MANPATH}:"; export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}"; Install MacPorts for your version of Mac OS
xcode-select --install 2. Install MacPorts for your version of Mac operating system: Macport installation adds the following two variables settings in the .zprofile export PATH="/opt/local/bin:/opt/local/sbin:$PATH" export MANPATH="/opt/local/share/man:$MANPATH" After installation is done, to keep your MacPorts system always current, is recommended that you you run on a regular basis:: sudo port -v selfupdate To check the version of Macports installed use the command: port version To install/uninstall a package sudo port install <package> sudo port uninstall <package> To check if a macport is installed use: port installed | grep <package> To check the content of a package use: port -q content <package> To check the location where a package is installed use: port -q content <package> | grep -E '/s?bin/' To check the version of a package avaliable w/o installing it use: port list <package> For a nice thorough documentation check out the Mac Port Guide at this link 3. (optional) When building some ports from source you may need to install Apple's Xcode Developer Tools.
Link to (all) Xcode Developer Tools To check the version of Xcode Tools installed use the following commands: xcodebuild -version xcode-select --version softwareupdate --history 4. (optional) Install the X11 windowing environment (needed for ports that depend on this functionality).
Required packages
brew install icarus-verilog sudo port install ngspice
brew install libxaw brew install libxpm brew install libxft brew install libxcb Install ngspice using HomebrewThis is the fastest approach, but requires a few tweaks and the result has a few oddities 1. Google for homebrew ngspice cd ~/Downloads brew edit ngspice.rb change: --without-x into --with-x and add the lines: --enable-predictor --enable-osdi brew install ncurses brew install libxt brew install libxaw brew reinstall --build-from-source ngspice.rb NOTE: In some case libxft causes issues with the Homebrew installation! If needed uninstall it! Ngspice gets successfully installed in the following location: /opt/homebrew/bin/ngspice On macOS with intel processor /usr/local/bin/ngspice There are a couple of Warnings that come up when running ngspice but they are innocuous: (at least as far as I can tell) Warning: locale not supported by Xlib, locale set to C Warning: X locale modifiers not supported, using default Warning: Unable to load any usable fontset Download and compile ngspice from sourceinstallation verified on
cd ~ 2. Download the latest ngspice from this link 3. expand the tarball tar -xzvf ngspice-41.tar.gz cd ngspice-41 read carefully the instructions in the file INSTALL 4. Install an X11 interface (like Xquartz)
5. Install the following additional packages sudo port install autoconf automake libtool bison flex ncurses xorg-libXaw \ readline fontconfig freetype libomp 6. Compile ngspice using the script compile_macos_clang.sh ngspice-41 on i7 with OS Big Sur and MontereyBefore running the script compile_macos_clang.sh make sure to add the following line to the command ../configure : --prefix=/Users/$(whoami)/opt/ngspice --enable-predictor --enable-osdi The ../configure command looks as follow: ../configure --prefix=/Users/$(whoami)/opt/ngspice --enable-predictor --enable-osdi \ --with-x --enable-xspice --enable-cider \ --with-readline=/usr/local/opt/readline --disable-debug \ CFLAGS="-m64 -O2 -I/opt/X11/include/freetype2 \ -I/usr/local/opt/readline/include -I/usr/local/opt/ncurses/include" \ LDFLAGS="-m64 -L/usr/local/opt/readline/lib -L/usr/local/opt/ncurses/lib -L/opt/X11/lib" ngspice-41 on Apple Silicon with OS Ventura 13.5.2Before running the script compile_mac_clang.sh make sure to modify the ../configure command as follows: ../configure --prefix=/Users/$(whoami)/opt/ngspice --enable-predictor --enable-osdi \ --with-x --enable-xspice --enable-cider \ --with-readline=yes --disable-debug \ CFLAGS="-m64 -O2 -I/opt/X11/include/freetype2 \ -I/usr/local/opt/readline/include -I/usr/local/opt/ncurses/include" \ LDFLAGS="-m64 -L/usr/local/opt/readline/lib -L/usr/local/opt/ncurses/lib -L/opt/X11/lib" Download and compile magic from sourceinstallation verified on
sudo port install m4 sudo port install tcsh sudo port install blt sudo port install freeglut sudo port install mesa sudo port install libGLU sudo port install cairo sudo port install tcl sudo port install tk sudo port install sqlite3-tcl sudo port install tclreadline 2. download magic using git cd ~ git clone git://opencircuitdesign.com/magic magic_git cd magic_git 3. configure and compile magic ./configure --prefix=/Users/$(whoami)/opt/magic --with-tcl=/opt/local/lib \ --with-tk=/opt/local/lib --x-includes=/opt/local/include --x-libraries=/opt/local/lib make make install In the past before running make was necessary to edit the file defs.mak and add to the CFLAGS -O2 -Wno-error -Wno-implicit-function-declaration 4. set up the techfiles of the processes you plan to use cd $CAD_ROOT/magic/sys mkdir current cd current copy the tech files you plan to use in the directory current Examples
the variable $CAD_ROOT is set as follows: export $CAD_ROOT=$HOME/opt/magic/lib 5. link the skywater 130nm PDK with magic sudo ln -s $PDK_ROOT/sky130A/libs.tech/magic/* $CAD_ROOT/magic/sys/ the variable $PDK_ROOT is the PDKs installation directory Example export PDK_ROOT=$HOME/share/pdks Download and compile netgen from sourceinstallation verified on
cd ~ git clone git://opencircuitdesign.com/netgen git_netgen cd git_netgen 2. configure and compile netgen ./configure --prefix=/Users/$(whoami)/opt/netgen --with-tcl=/opt/local/lib --with-tk=/opt/local/lib make make install Download and compile xschem from source
installation verified on
sudo port install gawk brew install macvim sudo port install gaw sudo port install dbus 2. download and configure the latest source distribution using git git clone https://github.com/StefanSchippers/xschem.git xschem_git cd xschem_git ## set prefix to the base directory where xschem and his support files will be installed ## if unspecified default is /usr/local ./configure --prefix=/Users/$(whoami)/opt/xschem 3. compile and install xschem
CFLAGS=-std=c99 -I/opt/X11/include -I/opt/X11/include/cairo \ -I/opt/local/include -O2 LDFLAGS=-L/opt/X11/lib -L/opt/local/lib -lm -lcairo -ljpeg\ -lX11 -lXrender -lxcb -lxcb-render -lX11-xcb -lXpm -ltcl8.6 -ltk8.6 make make install NOTE:With Ventura 13.3 on Apple Silicon xschem has issues with the mapping of the colors. This makes xschem "unusable".
Since xschem's default terminal is xterm it is worth to create in the home directory a file .Xdefaults with your favorite preferences: .Xdefaults
xterm*Background: lightblue xterm*Foreground: black xterm*VT100*geometry: 80x20 xterm*faceName: Monospace xterm*faceSize: 10 xterm*scrollBar: true xterm*saveLines: 1000 xterm*rightScrollBar: true xterm*multiScroll: on xterm*jumpScroll: on |