Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 43 additions & 57 deletions docs/user_guide/mac_install.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
# Mac

This guide is intended to provide installation instructions on **macOS** for Apple branded desktops and laptops. It begins with a list of dependencies required with instructions for installing RST. This process was designed for OS **Sierra** and above, but should still work on any machine which can run XCode. If you encounter any problems with installing RST, please create an [issue](https://github.com/superdarn/rst/issues/new) describing your problem and the error message you receive. The community will then help you solve the problem and add it into our troubleshooting section to help other users.

Table of Contents:
-------------------

1. [Library Requirements](#library-requirements)
1. [Macports](#macports)
2. [Homebrew](#homebrew)
3. [CDF](#cdf)
2. [Installation](#installation)
3. [Troubleshooting](#troubleshooting)
This guide is intended to provide installation instructions on **macOS** for Apple-branded desktops and laptops. It begins with a list of dependencies required with instructions for installing RST. This process was designed for OS **Sierra** and above, but should still work on any machine which can run XCode. If you encounter any problems with installing RST, please create an [issue](https://github.com/superdarn/rst/issues/new) describing your problem and the error message you receive. The community will then help you solve the problem and add it into our troubleshooting section to help other users.

## Library Requirements

Expand All @@ -24,65 +14,57 @@ Note that the names of the following dependencies have been known to change slig

[Macports install guide](https://www.macports.org/install.php)

[Homebrew install guide](https://docs.brew.sh/Installation)

You also need the CDF library, see below.
### Homebrew Install (Recommended)

#### For Intel-based (x86, i3, i5, i7, etc)
If you are on an Intel-based (x86) Mac device, you can install homebrew with the following terminal command:
###
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Dependencies |
------------------------|
libhdf5 |
libncurses |
libpng16 |
libx11 |
netpbm |
netcdf |
#### For ARM-based Macs (M1 or above)
If you are on an ARM-based Mac device (M1 or above), you must install the x86 version of Homebrew in your `/usr/local` directory. First, if you do not already have installed, install Rosetta (Apple x86 compatibility layer) by running the following in a terminal window:
###
softwareupdate --install-rosetta

Installation line:
After Rosetta is installed, close all active terminal windows, right-click "get info" on the terminal application (in the /Applications/ directory) and check "Open using Rosetta". After you have finished installing RST, you may safely uncheck this box (RST will continue to work in a non-Rosetta window).

> Warning! If you are using a Mac with an ARM64 architecture CPU (M1 and beyond), you must first install Rosetta and perform the install within a Rosetta enabled terminal. To do so, in a regular terminal run:

###
softwareupdate --install-rosetta

> Then locate your terminal application in finder, select "Get Info" from the right click menu, and check the "Open using Rosetta" option. After installation, you may uncheck this option.
Install the x86 version of Homebrew in a Rosetta-enabled window:
###
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

## Installing pre-requesites
### Macports

sudo port install libhdf5 libnetcdf libcurses libpng16 libx11 netpbm (10.77.03_2+x11)

### Homebrew

sudo brew install hdf5 netcdf ncurses libpng netpbm

For X11, make sure you have XCode installed from the macOS App store

Now install the [CDF](#cdf)
### ARM-based Macs

### CDF
You specifically need the x86 version of `netcdf`. Sometimes, Homebrew may try to install the ARM-based version if you have two versions of Homebrew installed (ARM in `/opt/homebrew`, x86 in `/usr/local`), even if you're in a Rosetta window. To force `netcdf` to install an x86 version in the correct place, run:
###
/usr/local/bin/brew install netcdf

!!! Note
**Make sure you successfully installed the ncurses library for your distribution first.**
You can find the latest release at: [http://cdf.gsfc.nasa.gov/](http://cdf.gsfc.nasa.gov)
For macOS it is also available through MacPorts, as are all listed dependencies. However, if the MacPorts installation errors or you do not use MacPorts, you may follow the instructions below.

From the above site, navigate to the `macosx` directory and download the pre-compiled binary file `cdf[XX_X]-setup_universal_binary.tar.gz`, where `XX_X` is the version number of the latest release.

Unpack the binary using the following steps:
## XCode

All Macs need XCode to get X11 and run RST properly. You can download this normally from the [Mac App Store](https://apps.apple.com/ca/app/xcode/id497799835?mt=12). Nothing different is required for x86 or ARM Macs.

1. `tar -xzvf cdf[XX_X]-setup_universal_binary.tar.gz`
2. double-click on the unpacked binary to be led through installation instructions.
## CDF

Alternatively, you may follow the instructions given on the [linux page](linux_install.md), replacing:
> Note
**Make sure you successfully installed the ncurses library for your distribution first.**

You can find the latest release at: [http://cdf.gsfc.nasa.gov/](https://spdf.gsfc.nasa.gov/pub/software/cdf/dist/latest/macosx/)

`make OS=linux ENV=gnu all` with `make OS=macosx ENV=gnu all`.
For macOS, it is also available through MacPorts, as are all listed dependencies. However, if the MacPorts installation errors or you do not use MacPorts, you may follow the instructions below.

You can now delete the `cdfXX_X-dist` directory or binary and the `tar.gz` archive.
From the above site, navigate to the `/cdf/dist/latest/macosx` directory and download the pkg file `CDFX_X_X-binary_signed.pkg`, where `X_X_X` is the version number of the latest release. Double click the file where you downloaded it and install it like a normal Mac package.

Now go to the [Installation](#installation)

#### TroubleShooting:
## TroubleShooting:

> If you find any problems/solutions, please create a [github issue](https://github.com/superdarn/rst/issues/new) so the community can help you or add it to the documentation

Expand Down Expand Up @@ -120,33 +102,37 @@ Error: curses.h not found
Open `rst/.profile/base.bash` to check paths are correctly set:

`XPATH, NETCDF_PATH, CDF_PATH`
To check if the paths are set correctly locate the following header files:
- For XPATH `locate png.h`
- For NETCDF_PATH `locate netcdf.h`
- For CDF_PATH `locate cdf.h`

These locate commands will point to the `\include` sub directory for the respective library. Make sure your path ends in the parent directory above this (e.g., `/Applications/cdf/cdf39_0-dist` and not `/Applications/cdf/cdf39_0-dist/include`.
To change the paths to the locations of appropriate header files:
- For XPATH, this is the location of X11, which is included with XCode. It should be `"opt/X11/"` for ARM-based Macs and `"usr/X11/"` for x86 Macs. The `/include` folder in here contains .h files (headers) that RST requires, like `png.h`.
- For NETCDF_PATH, point this to where you installed netcdf. This should be `"/usr/local/Cellar/netcdf/X.X.X_X"` if you installed it with Homebrew for both types of Macs, where the X's are the version number.
- For CDF_PATH, this will be where the CDF package is installed. It should be something like `"/Applications/cdf/cdf"`. The directory pointed to should contain the CDF `ReadMe.txt`.

- If you have **IDL**, check to see that `IDL_IPATH` in `rst/.profile/idl.bash` is correct.
(Note: for users without IDL, modifying the `IDL_IPATH` environment variable is
not required).

2. Load the RST environment variables. Open and edit your `~/.bashrc` file to include:
3. When compiling RST later, `png.c`, located in `/RSTINSTALLLOCATION/codebase/base/src.lib/graphic/fbuffer.1.19/src/png.c`, doesn't seem to find the `png.h` header file correctly, even though it is located in the XPATH defined in the previous step. As a patch fix while we work out what to do more cleanly, you need to change a line to point directly to `png.h`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3. When compiling RST later, `png.c`, located in `/RSTINSTALLLOCATION/codebase/base/src.lib/graphic/fbuffer.1.19/src/png.c`, doesn't seem to find the `png.h` header file correctly, even though it is located in the XPATH defined in the previous step. As a patch fix while we work out what to do more cleanly, you need to change a line to point directly to `png.h`
3. When compiling RST later, `png.c`, located in `$RSTPATH/codebase/base/src.lib/graphic/fbuffer.1.19/src/png.c`, doesn't seem to find the `png.h` header file correctly, even though it is located in the XPATH defined in the previous step. As a patch fix while we work out what to do more cleanly, you need to change a line to point directly to `png.h`

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend putting this whole section in "Troubleshooting" with an example of the error message that pops up when things aren't working correctly.


- Go to `png.c` and change line 32 `#png.h>` to `#include </opt/X11/include/png.h>` or `#include </usr/X11/include/png.h>`, for ARM and x86-based Macs, respectively. If your compilation still errors on `png.c`, make sure this is pointed to `png.h` correctly on your machine.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is too specific. My png.h header was not located under X11. Instead, I recommend directing users to find the location of their png.h header using something like: find /opt/ -type f -name 'png.h' or find /usr/ -type f -name 'png.h'


5. Load the RST environment variables. Open and edit your `~/.bashrc` (or `~/.zshrc` if you're on an ARM file, or have switched from bash to zsh) to include:

# bash profile for rst
export RSTPATH="INSTALL LOCATION"/rst
. $RSTPATH/.profile.bash

where the INSTALL LOCATION is the path with the RST repository that has been copied to your
computer. In order to load the environment variables you just setup, you'll need to close
computer. To load the environment variables you just set up, you'll need to close
your current terminal and open a new terminal, or from the command line type:

source ~/.bashrc

3. Run `make.build` from the command line. You may need to change directory to `$RSTPATH/build/script`.
6. Run `make.build` from the command line. You may need to change directory to `$RSTPATH/build/script`.
This runs a helper script that sets up other compiling code.

4. In the same directory run `make.code` to compile all of the code.
7. In the same directory run `make.code` to compile all of the code.
This runs a script to find all of the source codes and compile them into binaries.
A log of this compilation is stored in `$RSTPATH/log`.

Expand Down
Loading