Skip to content

Instantly share code, notes, and snippets.

@raziele
Created December 14, 2019 22:17
Show Gist options
  • Save raziele/9e89a5a4ad77382583496f07a8e6eb0b to your computer and use it in GitHub Desktop.
Save raziele/9e89a5a4ad77382583496f07a8e6eb0b to your computer and use it in GitHub Desktop.
A script to download and install GnuRadio 3.8 on MacOS (works on Catalina)
#!/bin/bash
# This script installs gnuradio 3.8
# Assuming homebrew is installed
# TODO: also install other modules (e.g gr-osmocomm)
#
# Step 1: Install Homebrew packages
echo "Installing necessary packages from Homebrew"
BREW_PACKAGES_LIST=(
"python"
"pkg-config"
"boost"
"swig"
"cmake"
"orc"
"mpir"
"gmp"
"cairo"
"pygobject3"
"gtk+3"
"gsl"
"qt"
"qwt"
"zeromq"
"adwaita-icon-theme"
)
PIP_PACKAGES_LIST=(
"click"
"click-plugins"
"numpy"
"bokeh"
)
for pkg in ${BREW_PACKAGES_LIST[@]}; do
brew install $pkg
done
# this is installed in order to support zeromq compilation
brew tap dholm/homebrew-sdr
brew update
brew cppzmq
# Step 2 - pip3 packages install
echo "Installing necessary packages from pip"
echo "Using" $(which pip3)
for pkg in ${PIP_PACKAGES_LIST[@]}; do
pip3 install $pkg
done
# Step 3 - download gnuradio
GR_URL="https://github.com/gnuradio/gnuradio.git"
GR_BRANCH="maint-3.8"
git clone $(GR_URL) ~/gnuradio_cloned_rep
cd ~/gnuradio_cloned_rep
git checkout $(GR_BRANCH)
# Step 4 - compile and install
mkdir build && cd build
CMAKE_FLAGS=""
CMAKE_FLAGS+="-DCMAKE_SYSTEM_PREFIX_PATH="/usr/local/;/usr/local/Cellar/;/usr/local/opt/qt;/usr/local/lib""
CMAKE_FLAGS+="-DQT_INCLUDE_DIRS="/usr/local/Cellar/qt/5.13.2/lib/QtGui.framework/Versions/5/Headers""
CMAKE_FLGAS+="-DQWT_INCLUDE_DIRS="/usr/local/Cellar/qwt/6.1.4/lib/qwt.framework/Versions/6/Headers""
# This will put gnuradio in ~/bin/ when the script runs make install. You may change it to your preferred location
CMAKE_FLAGS+="-DCMAKE_INSTALL_PREFIX="~/bin/gnuradio""
cmake .. $(CMAKE_FLAGS)
# this will take time...
make -j2
make install
echo "Gnuradio install completed! you can now run gnuradio binaries from the installed folder (e.g ~/bin/gnuradio/bin)"
echo "Please make sure your PYTHONPATH points to the dist-packages folder in the gnuradio folder. You can do it tomporarily by adding to the environment variable like this:
export PYTHONPATH=$PYTHONPATH:~/bin/gnuradio/lib/python4.7/dist-packages"
echo "After verifying thet everything is working correctly, you can safely delete ~/gnuradio_cloned_rep"
echo "Happy wi-cking!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment