OSX 10.13 Build Environment Configuration

--CASA Developer--



You must have root access to your computer.


 Install Xcode 10





Accept Apple EULA


xcodebuild -license


 Install Xcode command line tools

From the terminal:

xcode-select --install



 Install Java

Verify that you have Java 1.5 or later installed. This is required for Casa Code to compile. Open up a terminal and type:

java -version

You should get a response like:

java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

If you don't, download and install Java from here: https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html


 Download, Unpack and Install Macports


 Run the following commands as sudoed root


sudo su -




curl -o MacPorts-2.5.3.tar.gz https://distfiles.macports.org/MacPorts/MacPorts-2.5.3.tar.gz
tar zxf MacPorts-2.5.3.tar.gz
cd MacPorts-2.5.3
./configure --prefix=/opt/casa/02 --with-macports-user=root --with-applications-dir=/opt/casa/02/Applications
make install

 Configure Environment


This will make the port command run with the -s flag, which will compile all of the ports from the source.


sudo su -
mkdir /var/root/bin
touch ~/.profile
chmod 700 ~/.profile

Create file /var/root/bin/port and add the following contents.

/opt/casa/02/bin/port -N -s $*

Make the file executable

 chmod 755 /var/root/bin/port

Add the following in the .profile

export PATH=/opt/casa/02/bin:$PATH
# Required for the latest version of Qt4 port
export PATH=/opt/casa/02/libexec/qt4/bin:$PATH
# Port binaries
export PATH=/var/root/bin/:$PATH

Run the following commands.

. ~/.profile
type port
# This should return
# /var/root/bin/port


 Fetch Port Overlay

cd /opt/casa
git clone https://open-bitbucket.nrao.edu/scm/casa/casa-macports.git
ln -s /opt/casa/casa-macports/ports /opt/casa/ports
scp <username>@ssh.cv.nrao.edu:~dschieb/patch-531 /opt/casa/ports/graphics/pgplot/files

 Fetch Port Repository

cd /opt/casa
git clone https://open-bitbucket.nrao.edu/scm/casa/casa-mp-base.git
cd casa-mp-base
git checkout 1013-bld-1

 Configure MacPorts Source


echo 'file:///opt/casa/ports [nosync]' > /opt/casa/02/etc/macports/sources.conf
echo 'file:///opt/casa/casa-mp-base [nosync]' >> /opt/casa/02/etc/macports/sources.conf
#echo 'rsync://rsync.macports.org/release/ports [default]' >> /opt/casa/02/etc/macports/sources.conf


 Index the base MacPorts repository

cd /opt/casa/casa-mp-base

 Verify that the sources.conf looks correct:


bash-3.2# cat /opt/casa/02/etc/macports/sources.conf
file:///opt/casa/ports [nosync]
file:///opt/casa/casa-mp-base [nosync]


 Update MacPorts

port selfupdate


 Install Ports


Note: All of the ports should be installed as root. The port dependencies change from time to time so you may not need to install all of the ports manually.




# Note: The xcode variant is needed due to the default variant depending on 
# libunwind_headers which causes gcc build to fail: https://trac.macports.org/ticket/57198
port install cctools +xcode
port install gcc5 port install readline port install python27 port select --set python python27 port select --set python2 python27 port install py27-gnureadline port install boost +python27 port install dbus port install dbus-cpp port install qt4-mac port install qwt61 +qt4 port install pgplot +gcc5 port install cfitsio port install wcslib +gcc5 port install gsl port install rpfits +gcc5 port install fftw-3 port install fftw-3-single port install cairo +quartz +x11 port install xercesc port install libxslt port install tk +quartz port install flex port install py27-matplotlib +tkinter +gcc5 port install py27-ipython port select --set ipython py27-ipython port select --set ipython2 py27-ipython port install dbus-python27 # Requires sudo port install swig port install swig-python port install py27-scipy +gcc5 port install py27-pyfits port install libsakura port install py27-gdbm # for running tests with robotframework port install gdb port install gradle # for nightly builds port install groovy # for nightly builds port install git-lfs # for data repository port install ccache
 Configure Git LFS (as root and and as the user)
git config --global filter.lfs.required true
git config --global filter.lfs.clean "git-lfs clean -- %f"
git config --global filter.lfs.smudge "git-lfs smudge -- %f"
git config --global filter.lfs.process "git-lfs filter-process"


 GDB Configuration

During the installation you will get this message:


You will need to make sure /System/Library/LaunchDaemons/com.apple.taskgated.plist has the '-p' option, e.g.
Due to kernel caching, you usually need to restart Mac OS X for this option to effect.


You will have to disable SIP to do the above steps. As an alternative you can do the following:


 Create certificate to sign ggdb

Open /Applications/Utilities/Keychain access
In the top menu, go to "Keychain Access" and select Certificate Assistant
Select "Create a certificate"
    Name: gdb-cert
    Identity Type: Self Signed root
    Certificate Type: Code Signing
Select "Let me override defaults"
Click continue
Click continue on the pop-up
Click continue
In the personal information, select values as you wish and click continue
Click continue
Click continue
Click continue on the "Key Usage Extension" screen
Verify that the Extended Key Usage Extension is set to "Code Signing" and click continue
Click continue
Click continue
In the "Specify a Location For The Certificate" screen select System and click continue
Select System in the Keychains pane and right click on the "gdb-cert"
Click on the triangle next to "Trust" to expand the options
In the "When using this certificate select "Always trust"
Click on the red "x" on the left top corner of the window. 
Provide your password
Open a terminal and enter 
"codesign -f -s gdb-cert /opt/casa/02/bin/ggdb"
Restart your machine


 Add ports to your path (as root and and as the user)

Include the following line in the .profile file in your home directory

export PATH=/opt/casa/02/libexec/qt4/bin:/opt/casa/02/bin:$PATH