Based on Multipass
In Catalina and later versions, MacOS no longer supports 32-bit software, so installing iraf / piraf on Mac cannot open xgterm. The best way I've found so far is to use Multipass (a lightweight ubuntu virtual machine) to install iraf
Multipass installation & basic commands
Enter command:
sudo snap install multipass
You can install multipass.
Next, create ubuntu partition. 60GB of space and 4GB of ARM are more than enough. It should be noted that if you need to modify the disk space later, it is difficult, so you can set more space here according to the actual situation.
multipass launch --name ubuntu2004-60GB --disk 60G --mem 4GB lts
List installed partitions:
multipass list
You can also see their running or stop status
Use the exec command to start:
multipass exec ubuntu2004-60GB -- bash --login
After that, you can see that you have entered ubuntu (the default user name is ubuntu)
Install iraf
Upgrade ubuntu first: (sudo command does not require password)
sudo apt update sudo apt upgrade
Next, install the packages required for iraf and pyraf:
sudo dpkg --add-architecture i386 sudo apt update sudo apt install lib32gcc-8-dev lib32gcc-7-dev lib32ncurses-dev libxmu6:i386 libxtst6:i386 libncurses5 libncurses5:i386 sudo apt install git libx11-dev tcsh
To install DS9:
sudo apt install saods9
To install the python 3 package:
sudo apt install python3 python3-pip python3-wheel python3-matplotlib python3-numpy python3-scipy python3-astropy python3-tk python3-ipython python3-pygments python3-jedi
To install the pyraf package:
python3 -m pip install --user pmw python3 -m pip install --user d2to1 python3 -m pip install --user stsci.distutils python3 -m pip install --user pyraf
At this point, the preparations are complete and you can start installing iraf
Install iraf:
wget -cNS ftp://siesoft:siesoft@ftp.iac.es/iraf-2.16.1_Ubu1804.run
Run setup:
sudo sh iraf-2.16.1_Ubu1804.run
Write some variables related to iraf to bash_profile:
echo '# IRAF-related variables' >> ~/.bash_profile echo 'export iraf="/opt/iraf/iraf-2.16.1/"' >> ~/.bash_profile echo 'export IRAFARCH="linux64"' >> ~/.bash_profile
Give way bash_profile effective:
source ~/.bash_profile ecl
Graphical interface
Install Xquartz first. Note that you need to change some settings in Xquartz. Open "security" in "preferences" and check "allow connections from network clients". This change can only be enabled after restart.
Before restarting, enter from the Mac terminal (reopen a terminal, not ubuntu):
multipass stop ubuntu2004-60GB
In this way, you can close multipass and keep the previous operation on it. Closing or opening multipass cannot be operated from the terminal of multipass!
After restarting, start ubuntu with the exec command mentioned earlier.
Use the ifconfig command on the Mac terminal to obtain the IP address:
export IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}') ; echo $IP
Note: it depends on whether your en0 or en1 has an inet value, which depends on the network card. If the output is empty, try changing en0 to en1.
On the Mac terminal, enter:
xhost + $IP
This step is to open permissions for this IP address. Note that if there is still a permission problem that cannot be opened, you can directly enter xhost + on the mac terminal to open all permissions
Then, in the Ubuntu terminal, enter:
export DISPLAY="IP_value:0"
Where IP_value is the IP address just obtained using ifconfig. For example:
export DISPLAY=183.173.157.192:0
To avoid having to re-enter every time you start, you can write it to bash_ In profile.
Try starting xgterm:
xgterm -ls
If xgterm appears here successfully, the installation is successful.
Initialize iraf/pyraf:
First, create login CL file initialization:
mkdir ~/iraf cd ~/iraf/ mkiraf
The example image check using iraf is normal enough:
ds9 & python3 from pyraf import iraf iraf.display("dev$pix", 1)
Share files between Mac and Ubuntu:
Using the mount command can share files between macOS and Ubuntu, which is also one of the benefits of Multipass.
In the ubuntu shell:
mkdir /home/ubuntu/data_interchange
In Mac terminals:
multipass mount /home/name/data_interchange ubuntu2004-60GB:/home/ubuntu/data_interchange
Where name can be replaced by your user name. You can drag a file to the data on the mac side_ In the interchange folder, check whether the early ubuntu shell can open it.
In this way, iraf has been successfully installed. You can open a fits file to check whether iraf is normal